summaryrefslogtreecommitdiffstats
path: root/mm/oom_kill.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2016-03-17 22:20:45 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 23:09:34 +0100
commit6afcf2895e6f229476bd0dc95fe915e639ae0a49 (patch)
treeefbe2b8cf10ddcfd023c7d8d5ef5bd9e9101e893 /mm/oom_kill.c
parentmm/zsmalloc: add `freeable' column to pool stat (diff)
downloadlinux-6afcf2895e6f229476bd0dc95fe915e639ae0a49.tar.xz
linux-6afcf2895e6f229476bd0dc95fe915e639ae0a49.zip
mm,oom: make oom_killer_disable() killable
While oom_killer_disable() is called by freeze_processes() after all user threads except the current thread are frozen, it is possible that kernel threads invoke the OOM killer and sends SIGKILL to the current thread due to sharing the thawed victim's memory. Therefore, checking for SIGKILL is preferable than TIF_MEMDIE. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: David Rientjes <rientjes@google.com> Cc: Michal Hocko <mhocko@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r--mm/oom_kill.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index fde3d374c0af..06f7e1707847 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -455,15 +455,11 @@ void exit_oom_victim(void)
bool oom_killer_disable(void)
{
/*
- * Make sure to not race with an ongoing OOM killer
- * and that the current is not the victim.
+ * Make sure to not race with an ongoing OOM killer. Check that the
+ * current is not killed (possibly due to sharing the victim's memory).
*/
- mutex_lock(&oom_lock);
- if (test_thread_flag(TIF_MEMDIE)) {
- mutex_unlock(&oom_lock);
+ if (mutex_lock_killable(&oom_lock))
return false;
- }
-
oom_killer_disabled = true;
mutex_unlock(&oom_lock);