OK, Linus, you are right... there are enough instances of this we are
not going to find them all (although I suspect Andrew's slab.c fixes
will cover most of the cases). Further, I think we can should actually
purposely call preempt_schedule() in certain cases after interrupt
reenable to check for reschedules...
Let's just make it a rule "no preemption if interrupts are off" and
enforce that.
{
struct thread_info *ti = current_thread_info();
- if (unlikely(ti->preempt_count))
- return;
- if (unlikely(irqs_disabled())) {
- preempt_disable();
- printk("bad: schedule() with irqs disabled!\n");
- show_stack(NULL);
- preempt_enable_no_resched();
+ /*
+ * If there is a non-zero preempt_count or interrupts are disabled,
+ * we do not want to preempt the current task. Just return..
+ */
+ if (unlikely(ti->preempt_count || irqs_disabled()))
return;
- }
need_resched:
ti->preempt_count = PREEMPT_ACTIVE;