Messages in this thread Patch in this message | | | Subject | [PATCH] bad: schedule() with irqs disabled! | From | Robert Love <> | Date | 03 Sep 2002 10:52:55 -0400 |
| |
On Tue, 2002-09-03 at 09:36, Morten Helgesen wrote:
> bad: schedule() with irqs disabled!
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.
Patch is against 2.5.33-BK, please apply.
Robert Love
diff -urN linux-2.5.33/kernel/sched.c linux/kernel/sched.c --- linux-2.5.33/kernel/sched.c Sat Aug 31 18:04:53 2002 +++ linux/kernel/sched.c Tue Sep 3 10:48:56 2002 @@ -1032,15 +1032,12 @@ { struct thread_info *ti = current_thread_info(); - if (unlikely(ti->preempt_count)) + /* + * 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; - if (unlikely(irqs_disabled())) { - preempt_disable(); - printk("bad: schedule() with irqs disabled!\n"); - show_stack(NULL); - preempt_enable_no_resched(); - return; - } need_resched: ti->preempt_count = PREEMPT_ACTIVE; - 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/
| |