From: Ingo Molnar Map special (multi-initialized) locking code to the lock validator. Has no effect on non-lockdep kernels. Signed-off-by: Ingo Molnar Signed-off-by: Arjan van de Ven Signed-off-by: Andrew Morton --- include/linux/wait.h | 11 +++++++++-- kernel/wait.c | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff -puN include/linux/wait.h~lock-validator-special-locking-waitqueues include/linux/wait.h --- devel/include/linux/wait.h~lock-validator-special-locking-waitqueues 2006-06-09 15:18:41.000000000 -0700 +++ devel-akpm/include/linux/wait.h 2006-06-09 15:18:41.000000000 -0700 @@ -77,12 +77,19 @@ struct task_struct; #define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ { .flags = word, .bit_nr = bit, } -static inline void init_waitqueue_head(wait_queue_head_t *q) +/* + * lockdep: we want one lock-type for all waitqueue locks. + */ +extern struct lockdep_type_key waitqueue_lock_key; + +static inline void __init_waitqueue_head(wait_queue_head_t *q) { - spin_lock_init(&q->lock); + spin_lock_init_key(&q->lock, &waitqueue_lock_key); INIT_LIST_HEAD(&q->task_list); } +extern void init_waitqueue_head(wait_queue_head_t *q); + static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) { q->flags = 0; diff -puN kernel/wait.c~lock-validator-special-locking-waitqueues kernel/wait.c --- devel/kernel/wait.c~lock-validator-special-locking-waitqueues 2006-06-09 15:18:41.000000000 -0700 +++ devel-akpm/kernel/wait.c 2006-06-09 15:18:41.000000000 -0700 @@ -11,6 +11,15 @@ #include #include +struct lockdep_type_key waitqueue_lock_key; + +void init_waitqueue_head(wait_queue_head_t *q) +{ + __init_waitqueue_head(q); +} + +EXPORT_SYMBOL(init_waitqueue_head); + void fastcall add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) { unsigned long flags; _