diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 8ee92fb76968..36d5dd88d990 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -747,6 +747,16 @@ bool task_will_free_mem(struct task_struct *task) return false; mm = p->mm; + + /* + * This task has already been drained by the oom reaper so there are + * only small chances it will free some more + */ + if (test_bit(MMF_OOM_REAPED, &mm->flags)) { + task_unlock(p); + return false; + } + if (atomic_read(&mm->mm_users) <= 1) { task_unlock(p); return true;