Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <rientjes@google.com>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Qian Cai <cai@lca.pw>
Link: http://lkml.kernel.org/r/20200721010127.17238-1-laoar.shao@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Yafang Shao and committed by
Linus Torvalds
619b5b46 b1aa7c93

+2
+2
mm/oom_kill.c
··· 861 861 862 862 p = find_lock_task_mm(victim); 863 863 if (!p) { 864 + pr_info("%s: OOM victim %d (%s) is already exiting. Skip killing the task\n", 865 + message, task_pid_nr(victim), victim->comm); 864 866 put_task_struct(victim); 865 867 return; 866 868 } else if (victim != p) {