[patch] sleep_on* disables interrupts before scheduling?

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Mon, 1 Mar 1999 13:18:42 +0100 (CET)


the attached patch fixes something that i think might be a minor bug. We
disable interrupts before scheduling in sleep_on. The __cli() is a bit
hidden in the unbalanced write_lock_irq/write_unlock pair. I couldnt find
any reason for the original behavior (is there any reason for it?), and
the system appears to be stable with this patch applied. The 'bug' has
been there for some time, so i'm not sure. While disabling interrupts
before calling schedule() is currently not quite a bug, it increases
interrupt latencies unnecessarily, and might break in the future in subtle
ways.

-- mingo

--- linux/kernel/sched.c.orig Sun Feb 28 14:39:13 1999
+++ linux/kernel/sched.c Mon Mar 1 12:50:01 1999
@@ -937,19 +949,14 @@
}

#define SLEEP_ON_VAR \
- unsigned long flags; \
struct wait_queue wait;

-#define SLEEP_ON_HEAD \
- wait.task = current; \
- write_lock_irqsave(&waitqueue_lock, flags); \
- __add_wait_queue(p, &wait); \
- write_unlock(&waitqueue_lock);
-
-#define SLEEP_ON_TAIL \
- write_lock_irq(&waitqueue_lock); \
- __remove_wait_queue(p, &wait); \
- write_unlock_irqrestore(&waitqueue_lock, flags);
+#define SLEEP_ON_HEAD \
+ wait.task = current; \
+ add_wait_queue(p, &wait);
+
+#define SLEEP_ON_TAIL \
+ remove_wait_queue(p, &wait);

void interruptible_sleep_on(struct wait_queue **p)
{

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/