linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] schedule() in_atomic() check
@ 2002-09-20 20:05 Robert Love
  0 siblings, 0 replies; only message in thread
From: Robert Love @ 2002-09-20 20:05 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Linus,

Resend of patch to make the in_atomic() check in schedule() actually
work.  You merged the PREEMPT_ACTIVE bits, we just need to handle the
exit() case correctly.

Tested with and without CONFIG_PREEMPT -- works like a charm.

Patch is against current BK.

	Robert Love

diff -urN linux-2.5.37/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.37/kernel/sched.c	Fri Sep 20 11:20:32 2002
+++ linux/kernel/sched.c	Fri Sep 20 15:49:05 2002
@@ -940,8 +940,17 @@
 	struct list_head *queue;
 	int idx;
 
-	if (unlikely(in_atomic()))
-		BUG();
+	/*
+	 * Test if we are atomic.  Since do_exit() needs to call into
+	 * schedule() atomically, we ignore that path for now.
+	 * Otherwise, whine if we are scheduling when we should not be.
+	 */
+	if (likely(current->state != TASK_ZOMBIE)) {
+		if (unlikely(in_atomic())) {
+			printk(KERN_ERR "bad: scheduling while atomic!\n");
+			dump_stack();
+		}
+	}
 
 #if CONFIG_DEBUG_HIGHMEM
 	check_highmem_ptes();






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-20 20:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-20 20:05 [PATCH] schedule() in_atomic() check Robert Love

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).