]> err.no Git - linux-2.6/blobdiff - mm/oom_kill.c
[NETFILTER] x_tables: Make XT_ALIGN align as strictly as necessary.
[linux-2.6] / mm / oom_kill.c
index d348b9035955e5a0ba91af683880ac0e41996fd0..14bd4ec7959736106b1d2574e1fdd82f999242bf 100644 (file)
@@ -274,6 +274,7 @@ void out_of_memory(gfp_t gfp_mask, int order)
                show_mem();
        }
 
+       cpuset_lock();
        read_lock(&tasklist_lock);
 retry:
        p = select_bad_process();
@@ -284,6 +285,7 @@ retry:
        /* Found nothing?!?! Either we hang forever, or we panic. */
        if (!p) {
                read_unlock(&tasklist_lock);
+               cpuset_unlock();
                panic("Out of memory and no killable processes...\n");
        }
 
@@ -293,12 +295,14 @@ retry:
 
  out:
        read_unlock(&tasklist_lock);
+       cpuset_unlock();
        if (mm)
                mmput(mm);
 
        /*
         * Give "p" a good chance of killing itself before we
-        * retry to allocate memory.
+        * retry to allocate memory unless "p" is current
         */
-       schedule_timeout_interruptible(1);
+       if (!test_thread_flag(TIF_MEMDIE))
+               schedule_timeout_interruptible(1);
 }