mm,oom_reaper: do not attempt to reap a task twice
authorTetsuo Handa <[email protected]>
Fri, 7 Oct 2016 23:58:48 +0000 (16:58 -0700)
committerLinus Torvalds <[email protected]>
Sat, 8 Oct 2016 01:46:27 +0000 (18:46 -0700)
commit8496afaba93ece80a83cbd096f0675a1020ddfc4
tree825d05640f386d2a773db46c4b449373b9422292
parent7ebffa45551fe7db86a2b32bf586f124ef484e6e
mm,oom_reaper: do not attempt to reap a task twice

"mm, oom_reaper: do not attempt to reap a task twice" tried to give the
OOM reaper one more chance to retry using MMF_OOM_NOT_REAPABLE flag.
But the usefulness of the flag is rather limited and actually never
shown in practice.  If the flag is set, it means that the holder of
mm->mmap_sem cannot call up_write() due to presumably being blocked at
unkillable wait waiting for other thread's memory allocation.  But since
one of threads sharing that mm will queue that mm immediately via
task_will_free_mem() shortcut (otherwise, oom_badness() will select the
same mm again due to oom_score_adj value unchanged), retrying
MMF_OOM_NOT_REAPABLE mm is unlikely helpful.

Let's always set MMF_OOM_REAPED.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: Michal Hocko <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/sched.h
mm/oom_kill.c