summaryrefslogtreecommitdiffstats
path: root/mm/oom_kill.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2006-09-26 08:31:31 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 17:48:49 +0200
commitaf5b912435de32fbede08cee949429823ed49781 (patch)
treeea1de1a800c6fc60537912d4dad35a3cf211c86e /mm/oom_kill.c
parent[PATCH] oom: handle oom_disable exiting (diff)
downloadlinux-af5b912435de32fbede08cee949429823ed49781.tar.xz
linux-af5b912435de32fbede08cee949429823ed49781.zip
[PATCH] oom: swapoff tasks tweak
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>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r--mm/oom_kill.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 55a05f1ef76d..f1aba7e7b760 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -60,6 +60,12 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
}
/*
+ * 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.
*/
points = mm->total_vm;
@@ -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) {