Re: [PATCH] schedule() in_atomic() fix

From: Robert Love (rml@tech9.net)
Date: Wed Sep 18 2002 - 10:06:29 EST


On Wed, 2002-09-18 at 00:46, Robert Love wrote:

> Attached patch fixes the scheduler in_atomic() problem with kernel
> preemption enabled (and is also working - when kernel preemption is on,
> it finds a couple issues during boot).

Attached version works with non-CONFIG_PREEMPT ...

        Robert Love

diff -urN linux-2.5.36/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.36/kernel/sched.c Tue Sep 17 20:58:48 2002
+++ linux/kernel/sched.c Wed Sep 18 11:03:44 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 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 "scheduling while atomic!\n");
+ dump_stack();
+ }
+ }
 
 #if CONFIG_DEBUG_HIGHMEM
         check_highmem_ptes();

-
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/



This archive was generated by hypermail 2b29 : Mon Sep 23 2002 - 22:00:22 EST