Re: [PATCH] BUG(): sched.c: Line 944

Linus Torvalds (torvalds@transmeta.com)
Tue, 17 Sep 2002 08:40:17 -0700 (PDT)


On Tue, 17 Sep 2002, Linus Torvalds wrote:
>
> I really think we need this to have a stable system. Alan still thinks
> preempt is unstable, and this helps counter some of that - by adding
> sanity checks that all the counters are doing the right thing.

That said, the exit() crap does end up being a bit unreadable. How about
just splitting up schedule() into the "normal schedule" and the "exit()"
case. In particular, there are a few other things that are illegal for
the non-exit case anyway, and that we migth as well check for. There are
also potentially things we might want to do in the exit case that we don't
want to do in the hot-path.

So we could just rename the current core "schedule()" functionality as
"static void do_schedule()", and then have

void schedule(void)
{
BUG_ON(in_atomic());
BUG_ON(current->state & TASK_ZOMBIE);
do_schedule();
}

void exit_schedule(void)
{
BUG_ON(!(current->state & TASK_ZOMBIE));
do_schedule();
}

which is simpler than playing games with preempt_count == -2, and also
allows us more sanity checking than we have right now (the TASK_ZOMBIE
thing is also a exit-specific thing, and there may well be others too).

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/