diff options
author | Michal Hocko <mhocko@suse.cz> | 2015-02-11 18:26:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-11 20:06:03 -0500 |
commit | 63a8ca9b2084fa5bd91aa380532f18e361764109 (patch) | |
tree | 05eec7d68be099271fd03aa76759800124905484 /mm/oom_kill.c | |
parent | 49550b605587924b3336386caae53200c68969d3 (diff) |
oom: thaw the OOM victim if it is frozen
oom_kill_process only sets TIF_MEMDIE flag and sends a signal to the
victim. This is basically noop when the task is frozen though because the
task sleeps in the uninterruptible sleep. The victim is eventually thawed
later when oom_scan_process_thread meets the task again in a later OOM
invocation so the OOM killer doesn't live lock. But this is less than
optimal.
Let's add __thaw_task into mark_tsk_oom_victim after we set TIF_MEMDIE to
the victim. We are not checking whether the task is frozen because that
would be racy and __thaw_task does that already. oom_scan_process_thread
doesn't need to care about freezer anymore as TIF_MEMDIE and freezer are
excluded completely now.
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
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.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 80b34e285f96..3cbd76b8c13b 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -266,8 +266,6 @@ enum oom_scan_t oom_scan_process_thread(struct task_struct *task, | |||
266 | * Don't allow any other task to have access to the reserves. | 266 | * Don't allow any other task to have access to the reserves. |
267 | */ | 267 | */ |
268 | if (test_tsk_thread_flag(task, TIF_MEMDIE)) { | 268 | if (test_tsk_thread_flag(task, TIF_MEMDIE)) { |
269 | if (unlikely(frozen(task))) | ||
270 | __thaw_task(task); | ||
271 | if (!force_kill) | 269 | if (!force_kill) |
272 | return OOM_SCAN_ABORT; | 270 | return OOM_SCAN_ABORT; |
273 | } | 271 | } |
@@ -423,6 +421,14 @@ void note_oom_kill(void) | |||
423 | void mark_tsk_oom_victim(struct task_struct *tsk) | 421 | void mark_tsk_oom_victim(struct task_struct *tsk) |
424 | { | 422 | { |
425 | set_tsk_thread_flag(tsk, TIF_MEMDIE); | 423 | set_tsk_thread_flag(tsk, TIF_MEMDIE); |
424 | |||
425 | /* | ||
426 | * Make sure that the task is woken up from uninterruptible sleep | ||
427 | * if it is frozen because OOM killer wouldn't be able to free | ||
428 | * any memory and livelock. freezing_slow_path will tell the freezer | ||
429 | * that TIF_MEMDIE tasks should be ignored. | ||
430 | */ | ||
431 | __thaw_task(tsk); | ||
426 | } | 432 | } |
427 | 433 | ||
428 | /** | 434 | /** |