]> err.no Git - linux-2.6/commitdiff
[PATCH] oom: swapoff tasks tweak
authorNick Piggin <npiggin@suse.de>
Tue, 26 Sep 2006 06:31:31 +0000 (23:31 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 15:48:49 +0000 (08:48 -0700)
PF_SWAPOFF processes currently cause select_bad_process to return straight
away.  Instead, give them high priority, so we will kill them first, however
we also first ensure no parallel OOM kills are happening at the same time.

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

index 55a05f1ef76da7fd12a53085ad8fd73b2117ab5d..f1aba7e7b760b0a8533ef39d11897a29d2523165 100644 (file)
@@ -59,6 +59,12 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
                return 0;
        }
 
+       /*
+        * swapoff can easily use up all memory, so kill those first.
+        */
+       if (p->flags & PF_SWAPOFF)
+               return ULONG_MAX;
+
        /*
         * The memory size of the process is the basis for the badness.
         */
@@ -230,8 +236,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
                }
                if (p->oomkilladj == OOM_DISABLE)
                        continue;
-               if (p->flags & PF_SWAPOFF)
-                       return p;
 
                points = badness(p, uptime.tv_sec);
                if (points > *ppoints || !chosen) {