]> Git Repo - linux.git/commit
mm, oom: remove sleep from under oom_lock
authorMichal Hocko <[email protected]>
Fri, 17 Aug 2018 22:49:04 +0000 (15:49 -0700)
committerLinus Torvalds <[email protected]>
Fri, 17 Aug 2018 23:20:32 +0000 (16:20 -0700)
commit9bfe5ded054b8e28a94c78580f233d6879a00146
tree0ad9d7261ab77ac01995e16abc1564c1d14bc872
parentd834c5ab83febf9624ad3b16c3c348aa1e02014c
mm, oom: remove sleep from under oom_lock

Tetsuo has pointed out that since 27ae357fa82b ("mm, oom: fix concurrent
munlock and oom reaper unmap, v3") we have a strong synchronization
between the oom_killer and victim's exiting because both have to take
the oom_lock.  Therefore the original heuristic to sleep for a short
time in out_of_memory doesn't serve the original purpose.

Moreover Tetsuo has noticed that the short sleep can be more harmful
than actually useful.  Hammering the system with many processes can lead
to a starvation when the task holding the oom_lock can block for a long
time (minutes) and block any further progress because the oom_reaper
depends on the oom_lock as well.

Drop the short sleep from out_of_memory when we hold the lock.  Keep the
sleep when the trylock fails to throttle the concurrent OOM paths a bit.
This should be solved in a more reasonable way (e.g.  sleep proportional
to the time spent in the active reclaiming etc.) but this is much more
complex thing to achieve.  This is a quick fixup to remove a stale code.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Michal Hocko <[email protected]>
Reported-by: Tetsuo Handa <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/oom_kill.c
This page took 0.052408 seconds and 4 git commands to generate.