Commit f660daac authored by David Rientjes's avatar David Rientjes Committed by Linus Torvalds

oom: thaw threads if oom killed thread is frozen before deferring

If a thread has been oom killed and is frozen, thaw it before returning to
the page allocator.  Otherwise, it can stay frozen indefinitely and no
memory will be freed.
Signed-off-by: default avatarDavid Rientjes <>
Reported-by: default avatarKonstantin Khlebnikov <>
Cc: Oleg Nesterov <>
Cc: KOSAKI Motohiro <>
Cc: KAMEZAWA Hiroyuki <>
Cc: "Rafael J. Wysocki" <>
Acked-by: default avatarMichal Hocko <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent d08c429b
......@@ -32,6 +32,7 @@
#include <linux/mempolicy.h>
#include <linux/security.h>
#include <linux/ptrace.h>
#include <linux/freezer.h>
int sysctl_panic_on_oom;
int sysctl_oom_kill_allocating_task;
......@@ -317,8 +318,11 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
* blocked waiting for another task which itself is waiting
* for memory. Is there a better alternative?
if (test_tsk_thread_flag(p, TIF_MEMDIE))
if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
if (unlikely(frozen(p)))
return ERR_PTR(-1UL);
if (!p->mm)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment