Poke in the eye regarding sleep_on
Since the 2.5 work now has begun, I should remind you Alan that you promised on this listto take care of getting rid of sleep_on for good just as soon as this tree opened.
Just in case you forgot ;-)
Regards: David Weinehall
_ _
// David Weinehall <[email protected]> /> Northern lights wander \\
// Maintainer of the v2.0 kernel // Dance across the winter sky // \> http://www.acc.umu.se/~tao/ </ Full colour fire </
Quoted 3 lines
Since the 2.5 work now has begun, I should remind you Alan that you promised on this listto take care of getting rid of
sleep_onfor good just as soon as this tree opened.
That was David Woodhouse.. but he is right
Quoted 5 lines · [email protected] said:
Quoted 3 lines
Since the 2.5 work now has begun, I should remind you Alan that you promised on this listto take care of getting rid of
sleep_onfor good just as soon as this tree opened.That was David Woodhouse.. but he is right
There are still cases where it's just about OK to use sleep_on(). If you _and_ your waker will hold the BKL, or if you call it with IRQs disabled and are woken from an ISR, which is horrible but does currently work. Also if you just don't _care_ if you miss a wakeup sometimes.
ISTR much filesystem code falls into the former category at the moment.
We _should_ remove sleep_on and friends, but let's start with this patch, which allows us to clean up the filesystem code later...
Note that I haven't put the check in the _timeout versions. Maybe we should.
Index: kernel/sched.c
===================================================================
RCS file: /inst/cvs/linux/kernel/sched.c,v
retrieving revision 1.4.2.57
sched.c +8 -0
@@ -777,6 +777,12 @@wait_queue_t wait; \init_waitqueue_entry (&wait, current); +#define SLEEP_ON_CHECK \ + if (current->lock_depth == -1) { \ + printk(KERN_WARNING __FUNCTION__ " called without BKL. Probable race.\n"); \ + BUG(); \ + } +#define SLEEP_ON_HEAD \ wq_write_lock_irqsave(&q->lock,flags); \ __add_wait_queue(q, &wait); \
@@ -790,6 +796,7 @@void interruptible_sleep_on (wait_queue_head_t *q) {SLEEP_ON_VAR + SLEEP_ON_CHECK current->state =TASK_INTERRUPTIBLE ;
@@ -814,6 +821,7 @@void sleep_on (wait_queue_head_t *q) {SLEEP_ON_VAR + SLEEP_ON_CHECK current->state =TASK_UNINTERRUPTIBLE ;
--
dwmw2