> When I see this problem at boot, preempt_count() returns 0x4000000
> (PREEMPT_ACTIVE) and kernel_locked() returns 0.
>
> I don't understand the semantics of PREEMPT_ACTIVE to know
> whether to
>
> (1) change the test back to using in_interrupt instead of in_atomic, or
> (2) change the definition of in_atomic(), or
> (3) look for a bug somewhere else.
There are two problems: First, PREEMPT_ACTIVE is indeed set on entry to
schedule() from preempt_schedule() so we need to check for that too.
Second, the BUG() is catching a bit of issues... you want something
like:
- if (unlikely(in_atomic()))
- BUG();
+ if (unlikely(in_atomic() && preempt_count() != PREEMPT_ACTIVE)) {
+ printk(KERN_ERR "schedule() called while non-atomic!\n");
+ show_stack(NULL);
+ }
I will send a patch to Linus.
> However, I know experimentally that changing the test back to
> using in_interrupt() results in a possibly unrelated BUG() at line 279
> of rmap.c:
This is unrelated.
Robert Love
-
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/