Re: [Announce] BKL shifting into drivers and filesystems - beware

From: David Woodhouse (dwmw2@infradead.org)
Date: Fri Jul 14 2000 - 03:43:38 EST


torvalds@transmeta.com said:
> On Thu, 13 Jul 2000, Alan Cox wrote:
> > This kind of lock shifting is a major upheaval. It invalidates any
> > device driver testing done in the past weeks when we have been slowly
> > moving towards more stability.

> I much rather do it now than later. Later means either: (a) during
> 2.4.x or (b) early in 2.5.x.

If we're going to do it, we're removing the last cases where it was valid
to use sleep_on() and friends (with a few exceptions).

Can we now remove sleep_on() completely, or at least apply something like
the following:

Index: sched.c
===================================================================
RCS file: /inst/cvs/linux/kernel/sched.c,v
retrieving revision 1.4.2.31
diff -u -w -r1.4.2.31 sched.c
--- sched.c 2000/07/13 10:13:52 1.4.2.31
+++ sched.c 2000/07/14 08:38:51
@@ -786,10 +786,18 @@
         __remove_wait_queue(q, &wait); \
         wq_write_unlock_irqrestore(&q->lock,flags);
 
+#define SLEEP_ON_LOCKCHECK \
+ if (current->lock_depth == -1 /* ? */) { \
+ printk(KERN_WARNING __FUNCTION__ " called without BKL held!\n"); \
+ BUG(); \
+ }
+
 void interruptible_sleep_on(wait_queue_head_t *q)
 {
         SLEEP_ON_VAR
 
+ SLEEP_ON_LOCKCHECK
+
         current->state = TASK_INTERRUPTIBLE;
 
         SLEEP_ON_HEAD
@@ -801,6 +809,8 @@
 {
         SLEEP_ON_VAR
 
+ SLEEP_ON_LOCKCHECK
+
         current->state = TASK_INTERRUPTIBLE;
 
         SLEEP_ON_HEAD
@@ -814,6 +824,8 @@
 {
         SLEEP_ON_VAR
         
+ SLEEP_ON_LOCKCHECK
+
         current->state = TASK_UNINTERRUPTIBLE;
 
         SLEEP_ON_HEAD
@@ -825,6 +837,8 @@
 {
         SLEEP_ON_VAR
         
+ SLEEP_ON_LOCKCHECK
+
         current->state = TASK_UNINTERRUPTIBLE;
 
         SLEEP_ON_HEAD

--
dwmw2

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



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:19 EST