Skip to contentSkip to conversation

lockdep/waitqueues: Add better annotation

tip:core/locking tip-bot for Peter Zijlstra 1 participant 1 message Dec 21, 2011 Scheduler

lore
Share & tools
lore
#0 lore raw
Commit-ID:  f07fdec50a13f134ea9608c8fb3f6408c58ef55e
Gitweb:     http://git.kernel.org/tip/f07fdec50a13f134ea9608c8fb3f6408c58ef55e
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Tue, 13 Dec 2011 13:20:54 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Dec 2011 10:07:39 +0100

lockdep/waitqueues: Add better annotation

-> #2 (&tty->write_wait){-.-...}:

is a lot more informative than:

-> #2 (key#19){-.....}:

---
 include/linux/wait.h |    4 ++--
 kernel/wait.c        |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/wait.h +2 -2
index 3efc9f3..a9ce45e 100644
@@ -77,13 +77,13 @@ struct task_struct;
 #define __WAIT_BIT_KEY_INITIALIZER(word, bit)				\
 	{ .flags = word, .bit_nr = bit, }
 
-extern void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *);
+extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
 
 #define init_waitqueue_head(q)				\
 	do {						\
 		static struct lock_class_key __key;	\
 							\
-		__init_waitqueue_head((q), &__key);	\
+		__init_waitqueue_head((q), #q, &__key);	\
 	} while (0)
 
 #ifdef CONFIG_LOCKDEP
kernel/wait.c +2 -2
index 26fa779..7fdd9ea 100644
@@ -10,10 +10,10 @@
 #include <linux/wait.h>
 #include <linux/hash.h>
 
-void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *key)
+void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *key)
 {
 	spin_lock_init(&q->lock);
-	lockdep_set_class(&q->lock, key);
+	lockdep_set_class_and_name(&q->lock, key, name);
 	INIT_LIST_HEAD(&q->task_list);
 }