[PATCH] BUG(): sched.c: Line 944

From: Robert Love (rml@tech9.net)
Date: Mon Sep 16 2002 - 13:48:58 EST


The current in_atomic() check fails with kernel preemption enabled since
we set preempt_count to PREEMPT_ACTIVE in preempt_schedule().

We need to additionally check whether PREEMPT_ACTIVE is set.

There is also still the issue that bugging out is a bit drastic and a
hindrance to debugging; but I will tackle that later. For now, please
apply this so we can at least boot with preemption enabled.

Patch is against 2.5.35-bk.

        Robert Love

diff -urN linux-2.5.35/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.35/kernel/sched.c Sun Sep 15 22:18:24 2002
+++ linux/kernel/sched.c Mon Sep 16 14:43:54 2002
@@ -940,8 +940,7 @@
         struct list_head *queue;
         int idx;
- if (unlikely(in_atomic()))
- BUG();
+ BUG_ON(in_atomic() && preempt_count() != PREEMPT_ACTIVE);
@@ -959,7 +958,7 @@
          * if entering off of a kernel preemption go straight
          * to picking the next task.
- if (unlikely(preempt_count() & PREEMPT_ACTIVE))
+ if (unlikely(preempt_count() == PREEMPT_ACTIVE))
                 goto pick_next_task;
         switch (prev->state) {

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:17 EST