--- /usr/tmp/TmpDir.25066-0/linux/mm/oom_kill.c_1.2 2004-11-15 15:16:46.000000000 -0800 +++ linux/mm/oom_kill.c 2004-11-15 15:16:23.000000000 -0800 @@ -41,9 +41,9 @@ * of least surprise ... (be careful when you change it) */ -int badness(struct task_struct *p) +unsigned long badness(struct task_struct *p) { - int points, cpu_time, run_time, s; + unsigned long points, cpu_time, run_time, s; if (!p->mm) return 0; @@ -83,7 +83,7 @@ */ if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_ADMIN) || p->uid == 0 || p->euid == 0) - points /= 4; + points /= 10; /* * We don't want to kill a process with direct hardware access. @@ -123,13 +123,13 @@ */ static struct task_struct * select_bad_process(void) { - int maxpoints = 0; + unsigned long maxpoints = 0; struct task_struct *g, *p; struct task_struct *chosen = NULL; do_each_thread(g, p) - if (p->pid) { - int points = badness(p); + if (p->pid && !(p->state & TASK_ZOMBIE)) { + unsigned long points = badness(p); if (points > maxpoints) { chosen = p; maxpoints = points; @@ -254,32 +254,6 @@ return; spin_lock(&oom_lock); - now = jiffies; - since = now - last; - last = now; - - /* - * If it's been a long time since last failure, - * we're not oom. - */ - last = now; - if (since > 5*HZ) - goto reset; - - /* - * If we haven't tried for at least one second, - * we're not really oom. - */ - since = now - first; - if (since < HZ) - goto out_unlock; - - /* - * If we have gotten only a few failures, - * we're not really oom. - */ - if (++count < 10) - goto out_unlock; /* * If we just killed a process, wait a while