2000-11-14 17:49:29

by Chris Swiedler

[permalink] [raw]
Subject: [PATCH] bugfix in oom_kill.c

This patch fixes a bug in oom_kill. The way it was written, the OOM killer
would try to kill the idle task if the task selected immediately before it
had the most "badness". Probably because of the order of for_each_task(),
this wouldn't ever happen, but I don't think we want to depend on that.

chris

--- official/linux-2.4.0/mm/oom_kill.c Mon Nov 6 23:53:01 2000
+++ work/linux-2.4.0-test10/mm/oom_kill.c Thu Nov 9 23:12:10 2000
@@ -124,11 +143,12 @@
read_lock(&tasklist_lock);
for_each_task(p)
{
- if (p->pid)
+ if (p->pid) {
points = badness(p);
- if (points > maxpoints) {
- chosen = p;
- maxpoints = points;
+ if (points > maxpoints) {
+ chosen = p;
+ maxpoints = points;
+ }
}
}
read_unlock(&tasklist_lock);