mm,oom_reaper: do not attempt to reap a task twice
[cascardo/linux.git] / mm / oom_kill.c
index 87fad95..45097f5 100644 (file)
@@ -578,20 +578,11 @@ static void oom_reap_task(struct task_struct *tsk)
        if (attempts <= MAX_OOM_REAP_RETRIES)
                goto done;
 
+       /* Ignore this mm because somebody can't call up_write(mmap_sem). */
+       set_bit(MMF_OOM_REAPED, &mm->flags);
+
        pr_info("oom_reaper: unable to reap pid:%d (%s)\n",
                task_pid_nr(tsk), tsk->comm);
-
-       /*
-        * If we've already tried to reap this task in the past and
-        * failed it probably doesn't make much sense to try yet again
-        * so hide the mm from the oom killer so that it can move on
-        * to another task with a different mm struct.
-        */
-       if (test_and_set_bit(MMF_OOM_NOT_REAPABLE, &mm->flags)) {
-               pr_info("oom_reaper: giving up pid:%d (%s)\n",
-                       task_pid_nr(tsk), tsk->comm);
-               set_bit(MMF_OOM_REAPED, &mm->flags);
-       }
        debug_show_all_locks();
 
 done: