From 76f752714690f90ed58de9460b3f12c4bcfae404 Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Tue, 10 Sep 2019 13:14:39 -0700 Subject: [PATCH] mm: oom_kill: Prevent debug messages from going to serial console Some devices use a watchdog driver which requires each cpu to be able to handle an IPI within one second. Since printing to serial console disables interrupts, the large amount of messages generated by dump_tasks() may trigger this scenario. Therefore, ensure that these messages are not displayed in nonfatal scenarios. Also fix a logic error with strcmp. Change-Id: Ifb6a09431747431478ce26ff89e38d6c6724af2d Signed-off-by: Patrick Daly [isaacm@codeaurora.org: Fixed trivial merge conflicts] Signed-off-by: Isaac J. Manjarres --- mm/oom_kill.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index d0cece9bdd15..237413d4be07 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1174,7 +1174,6 @@ 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; @@ -1190,11 +1189,10 @@ void add_to_oom_reaper(struct task_struct *p) } task_unlock(p); - if (__ratelimit(&reaper_rs) && p->signal->oom_score_adj == 0) { + if (!strcmp(current->comm, ULMK_MAGIC) && __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);