oom, suspend: fix oom_killer_disable vs. pm suspend properly
[cascardo/linux.git] / kernel / power / process.c
index 8f27d5a..2fba066 100644 (file)
@@ -144,23 +144,12 @@ int freeze_processes(void)
        /*
         * Now that the whole userspace is frozen we need to disbale
         * the OOM killer to disallow any further interference with
-        * killable tasks.
+        * killable tasks. There is no guarantee oom victims will
+        * ever reach a point they go away we have to wait with a timeout.
         */
-       if (!error && !oom_killer_disable())
+       if (!error && !oom_killer_disable(msecs_to_jiffies(freeze_timeout_msecs)))
                error = -EBUSY;
 
-       /*
-        * There is a hard to fix race between oom_reaper kernel thread
-        * and oom_killer_disable. oom_reaper calls exit_oom_victim
-        * before the victim reaches exit_mm so try to freeze all the tasks
-        * again and catch such a left over task.
-        */
-       if (!error) {
-               pr_info("Double checking all user space processes after OOM killer disable... ");
-               error = try_to_freeze_tasks(true);
-               pr_cont("\n");
-       }
-
        if (error)
                thaw_processes();
        return error;