Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 313d2ee0 authored by Liam Mark's avatar Liam Mark Committed by Vinayak Menon
Browse files

lowmemorykiller: enhance debug information



Add extra debug information to make it easier to both determine
why the lowmemorykiller killed a process and to help find the source
of memory leaks.

Also increase the debug level for "select" statements to help prevent
flooding the log.

Change-Id: I3b6876c5ecdf192ecc271aed3f37579f66d47a08
Signed-off-by: default avatarLiam Mark <lmark@codeaurora.org>
[vinmenon@codeaurora.org: fix checkpatch warnings]
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
parent b03ced71
Loading
Loading
Loading
Loading
+31 −11
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
#include <linux/delay.h>
#include <linux/swap.h>
#include <linux/fs.h>
#include <linux/cpuset.h>

#ifdef CONFIG_HIGHMEM
#define _ZONE ZONE_HIGHMEM
@@ -399,7 +400,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
		selected = p;
		selected_tasksize = tasksize;
		selected_oom_score_adj = oom_score_adj;
		lowmem_print(2, "select '%s' (%d), adj %hd, size %d, to kill\n",
		lowmem_print(3, "select '%s' (%d), adj %hd, size %d, to kill\n",
			     p->comm, p->pid, oom_score_adj, tasksize);
	}
	if (selected) {
@@ -415,15 +416,34 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
		trace_lowmemory_kill(selected, cache_size, cache_limit, free);
		lowmem_print(1, "Killing '%s' (%d), adj %hd,\n"
			"to free %ldkB on behalf of '%s' (%d) because\n"
				 "   cache %ldkB is below limit %ldkB for oom_score_adj %hd\n"
				 "   Free memory is %ldkB above reserved\n",
			"cache %ldkB is below limit %ldkB for oom score %hd\n"
			"Free memory is %ldkB above reserved.\n"
			"Free CMA is %ldkB\n"
			"Total reserve is %ldkB\n"
			"Total free pages is %ldkB\n"
			"Total file cache is %ldkB\n"
			"GFP mask is 0x%x\n",
			selected->comm, selected->pid,
			selected_oom_score_adj,
			selected_tasksize * (long)(PAGE_SIZE / 1024),
			current->comm, current->pid,
			cache_size, cache_limit,
			min_score_adj,
			     free);
			free,
			global_page_state(NR_FREE_CMA_PAGES) *
			(long)(PAGE_SIZE / 1024),
			totalreserve_pages * (long)(PAGE_SIZE / 1024),
			global_page_state(NR_FREE_PAGES) *
			(long)(PAGE_SIZE / 1024),
			global_node_page_state(NR_FILE_PAGES) *
			(long)(PAGE_SIZE / 1024),
			sc->gfp_mask);

		if (lowmem_debug_level >= 2 && selected_oom_score_adj == 0) {
			show_mem(SHOW_MEM_FILTER_NODES);
			dump_tasks(NULL, NULL);
		}

		lowmem_deathpending_timeout = jiffies + HZ;
		rem += selected_tasksize;
		rcu_read_unlock();