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

Linus Torvalds
2002-09-16T18:53:14Z

On 16 Sep 2002, Robert Love wrote:
>
> The current in_atomic() check fails with kernel preemption enabled since
> we set preempt_count to PREEMPT_ACTIVE in preempt_schedule().
>
> We need to additionally check whether PREEMPT_ACTIVE is set.

Would it not be a lot better to just mask off PREEMPT_ACTIVE() instead of
checking for it explicitly.

The in_interrupt() etc stuff already effectively do this by masking off
the HARDIRQ_MASK etc. I would prefer a patch to hardirq.h that just adds a
#define to make preempt_count() not contain PREEMPT_ACTIVE - and make the
PREEMPT_ACTIVE checks be a totally separate check (logic: it's not a
count, so it shouldn't show up in preempt_count())

> There is also still the issue that bugging out is a bit drastic and a
> hindrance to debugging; but I will tackle that later. For now, please
> apply this so we can at least boot with preemption enabled.

I certainly wouldn't mind the DEBUG/WARNING/FATAL infrastructure discussed
earlier..

Linus