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

Linus Torvalds (torvalds@transmeta.com)
Mon, 16 Sep 2002 14:41:17 -0700 (PDT)


On 16 Sep 2002, Robert Love wrote:
>
> I liked this idea, and was working on implementing it when I ran into a
> few roadblocks. Your ideas are welcome.
>
> First, "preempt_count()" is used as an l-value in a lot of places, i.e.
> look at all the "preempt_count() += foo" in the IRQ code. We cannot
> mask things out of it.

Ok. Let's just make the masking explicit in in_atomic() then, like you
suggest:

> Simplest solution is to:
>
> #define in_atomic() \
> (preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
>
> although I still dislike the masking just to make the schedule()
> code-path cleaner.

I don't think this is a scheduler cleanliness issue: it's a consistency
issue. If "in_interrupt()" and friends do not care about PREEMPT_ACTIVE,
then neither should "in_atomic()". The fact that the scheduler test gets
cleaned up is secondary - although it is obviously a result of being
consistent.

> Oh, and there is another problem: printk() from schedule() implicitly
> calls wake_up(). My machine dies even with just a printk() and not a
> BUG()... I suspect there may be some SMP issue in that whole mess too,
> because setting oops_in_progress prior did not help.

Hmm.. It will call wake_up() because it will try to wake up any klogd.
What's the problem? Calling wake_up() should be fine from there..

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/