public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org, morten.helgesen@nextframe.net
Subject: [PATCH] bad: schedule() with irqs disabled!
Date: 03 Sep 2002 10:52:55 -0400	[thread overview]
Message-ID: <1031064775.979.3205.camel@phantasy> (raw)
In-Reply-To: <20020903153636.A1415@sexything>

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;


      reply	other threads:[~2002-09-03 14:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-03 13:36 [2.5.33] bad: schedule() with irqs disabled! Morten Helgesen
2002-09-03 14:52 ` Robert Love [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1031064775.979.3205.camel@phantasy \
    --to=rml@tech9.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morten.helgesen@nextframe.net \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox