From fd58a727b502c8e086adc7a3041c6e8c015e68e1 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Mon, 25 Sep 2006 23:31:31 -0700 Subject: [PATCH] --- yaml --- r: 35605 b: refs/heads/master c: af5b912435de32fbede08cee949429823ed49781 h: refs/heads/master i: 35603: 5b128f2c831695095c090555c950a1774609d1b5 v: v3 --- [refs] | 2 +- trunk/mm/oom_kill.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index fe66c11245ee..6975a1909e59 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4a3ede107e422a0c53d28024b0aa902ca22a8768 +refs/heads/master: af5b912435de32fbede08cee949429823ed49781 diff --git a/trunk/mm/oom_kill.c b/trunk/mm/oom_kill.c index 55a05f1ef76d..f1aba7e7b760 100644 --- a/trunk/mm/oom_kill.c +++ b/trunk/mm/oom_kill.c @@ -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) {