From 99f13d956418c6ee4b50091436901eb18dac8711 Mon Sep 17 00:00:00 2001 From: Charan Teja Reddy Date: Fri, 25 May 2018 14:43:43 +0530 Subject: [PATCH] mm: oom_kill: dump info of all tasks when the FG process is killed Dump the memory information of all tasks when the foreground process is killed and oom reaped. Change-Id: I3183f8893442d2597f2fc1cd6d092d9807226b2f Signed-off-by: Charan Teja Reddy [isaacm@codeaurora.org: invoke dump_tasks with OC structure ptr] Signed-off-by: Isaac J. Manjarres --- mm/oom_kill.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 6993791a517b..10ef502189f4 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1158,6 +1158,10 @@ void pagefault_out_of_memory(void) void add_to_oom_reaper(struct task_struct *p) { + static DEFINE_RATELIMIT_STATE(reaper_rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST); + struct oom_control oc = {}; + if (!sysctl_reap_mem_on_sigkill) return; @@ -1171,5 +1175,13 @@ void add_to_oom_reaper(struct task_struct *p) wake_oom_reaper(p); } task_unlock(p); + + if (__ratelimit(&reaper_rs) && p->signal->oom_score_adj == 0) { + show_mem(SHOW_MEM_FILTER_NODES, NULL); + show_mem_call_notifiers(); + if (sysctl_oom_dump_tasks) + dump_tasks(&oc); + } + put_task_struct(p); }