]> err.no Git - linux-2.6/commitdiff
[PATCH] oom: cpuset hint
authorNick Piggin <npiggin@suse.de>
Tue, 26 Sep 2006 06:31:29 +0000 (23:31 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 15:48:48 +0000 (08:48 -0700)
cpuset_excl_nodes_overlap does not always indicate that killing a task will
not free any memory we for us.  For example, we may be asking for an
allocation from _anywhere_ in the machine, or the task in question may be
pinning memory that is outside its cpuset.  Fix this by just causing
cpuset_excl_nodes_overlap to reduce the badness rather than disallow it.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/oom_kill.c

index 7d056843fa2db5c4196f6a4997cad0be2f2206ef..4f815b06ac1b678e8dba179997c1c77df733f819 100644 (file)
@@ -128,6 +128,14 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
        if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO))
                points /= 4;
 
+       /*
+        * If p's nodes don't overlap ours, it may still help to kill p
+        * because p may have allocated or otherwise mapped memory on
+        * this node before. However it will be less likely.
+        */
+       if (!cpuset_excl_nodes_overlap(p))
+               points /= 8;
+
        /*
         * Adjust the score by oomkilladj.
         */
@@ -198,9 +206,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
                        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 wait for it