From: Yafang Shao Date: Wed, 12 Aug 2020 01:31:32 +0000 (-0700) Subject: mm, oom: show process exiting information in __oom_kill_process() X-Git-Tag: v6.6-pxa1908~8490^2~140 X-Git-Url: https://git.dujemihanovic.xyz/?a=commitdiff_plain;h=619b5b469bcab84ea3bee1d8d04451c781d23feb;p=linux.git mm, oom: show process exiting information in __oom_kill_process() When the OOM killer finds a victim and tryies to kill it, if the victim is already exiting, the task mm will be NULL and no process will be killed. But the dump_header() has been already executed, so it will be strange to dump so much information without killing a process. We'd better show some helpful information to indicate why this happens. Suggested-by: David Rientjes Signed-off-by: Yafang Shao Signed-off-by: Andrew Morton Acked-by: Michal Hocko Cc: Tetsuo Handa Cc: Qian Cai Link: http://lkml.kernel.org/r/20200721010127.17238-1-laoar.shao@gmail.com Signed-off-by: Linus Torvalds --- diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 48e0db54d838..e90f25d6385d 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -861,6 +861,8 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) p = find_lock_task_mm(victim); if (!p) { + pr_info("%s: OOM victim %d (%s) is already exiting. Skip killing the task\n", + message, task_pid_nr(victim), victim->comm); put_task_struct(victim); return; } else if (victim != p) {