Re: 2.5.74-mm1

Andrew Morton
2003-07-05T18:27:41Z

William Lee Irwin III <wli@holomorphy.com> wrote:
>
> The badness() check isn't good enough. If badness() returns 0 for all
> processes with pid's > 0 and the first one seen is a kernel thread the
> kernel thread will be chosen.

Are we looking at the same code?

static struct task_struct * select_bad_process(void)
{
int 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 (points > maxpoints) {
chosen = p;
maxpoints = points;
}
if (p->flags & PF_SWAPOFF)
return p;
}
while_each_thread(g, p);
return chosen;
}

if badness() returns zero for everything, this returns NULL and
the kernel panics.