]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] bad: schedule() with irqs disabled!
authorRobert Love <rml@tech9.net>
Tue, 3 Sep 2002 05:43:11 +0000 (22:43 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 3 Sep 2002 05:43:11 +0000 (22:43 -0700)
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.

kernel/sched.c

index 0588a29a939328890fec359458fc0c0fd4945b5a..90344435318c0ead6fb4f34ac223096f5b1f5c8f 100644 (file)
@@ -1032,15 +1032,12 @@ asmlinkage void preempt_schedule(void)
 {
        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;