]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/oom_kill.c
[PATCH] add vfs_* helpers for xattr operations
[karo-tx-linux.git] / mm / oom_kill.c
index 3a1d46502938eaf7b5c03216a3f21a53e4d54deb..4748b906aff23451c9bbf838ddc1add16bbf1cc9 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/swap.h>
 #include <linux/timex.h>
 #include <linux/jiffies.h>
+#include <linux/cpuset.h>
 
 /* #define DEBUG */
 
@@ -152,6 +153,10 @@ static struct task_struct * select_bad_process(void)
                        continue;
                if (p->oomkilladj == OOM_DISABLE)
                        continue;
+               /* If p's nodes don't overlap ours, it won't help to kill p. */
+               if (!cpuset_excl_nodes_overlap(p))
+                       continue;
+
                /*
                 * This is in the process of releasing memory so for wait it
                 * to finish before killing some other task by mistake.
@@ -258,7 +263,7 @@ static struct mm_struct *oom_kill_process(struct task_struct *p)
  * OR try to be smart about which process to kill. Note that we
  * don't have to be perfect here, we just have to be good.
  */
-void out_of_memory(unsigned int __nocast gfp_mask, int order)
+void out_of_memory(gfp_t gfp_mask, int order)
 {
        struct mm_struct *mm = NULL;
        task_t * p;
@@ -293,8 +298,8 @@ retry:
 
        /*
         * Give "p" a good chance of killing itself before we
-        * retry to allocate memory.
+        * retry to allocate memory unless "p" is current
         */
-       __set_current_state(TASK_INTERRUPTIBLE);
-       schedule_timeout(1);
+       if (!test_thread_flag(TIF_MEMDIE))
+               schedule_timeout_interruptible(1);
 }