Give waitqueue spinlocks their own lockdep classes
PATCH 1/1 Give waitqueue spinlocks their own lockdep classes
From: Peter Zijlstra <[email protected]>
Give waitqueue spinlocks their own lockdep classes when they are initialised from init_waitqueue_head(). This means that struct wait_queue::func functions can operate other waitqueues.
This is used by CacheFiles to catch the page from a backing fs being unlocked and to wake up another thread to take a copy of it.
---
include/linux/wait.h | 9 ++++++++- kernel/wait.c | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-)
include/linux/wait.h +8 -1
@@ -77,7 +77,14 @@ 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); +extern void __init_waitqueue_head (wait_queue_head_t *q,struct lock_class_key *); + +#define init_waitqueue_head (q) \ + do { \ + static struct lock_class_key __key; \ + \ + __init_waitqueue_head((q), &__key); \ + } while (0)#ifdef CONFIG_LOCKDEP # define __WAIT_QUEUE_HEAD_INIT_ONSTACK (name) \
kernel/wait.c +3 -2
@@ -10,13 +10,14 @@#include <linux/wait.h> #include <linux/hash.h> -void init_waitqueue_head (wait_queue_head_t *q) +void __init_waitqueue_head (wait_queue_head_t *q,struct lock_class_key *key) {spin_lock_init (&q->lock); +lockdep_set_class (&q->lock, key);INIT_LIST_HEAD (&q->task_list); } -EXPORT_SYMBOL (init_waitqueue_head); +EXPORT_SYMBOL (__init_waitqueue_head);void add_wait_queue (wait_queue_head_t *q,wait_queue_t *wait) {
tip-bot for Peter Zijlstra
maintainer[tip:core/urgent] locking, sched: Give waitqueue spinlocks their own lockdep classes
Commit-ID: 2fc391112fb6f3424435a3aa2fda887497b5f807 Gitweb: http://git.kernel.org/tip/2fc391112fb6f3424435a3aa2fda887497b5f807 Author: Peter Zijlstra <[email protected]> AuthorDate: Mon, 10 Aug 2009 12:33:05 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 10 Aug 2009 14:43:09 +0200
locking, sched: Give waitqueue spinlocks their own lockdep classes
Give waitqueue spinlocks their own lockdep classes when they are initialised from init_waitqueue_head(). This means that struct wait_queue::func functions can operate other waitqueues.
This is used by CacheFiles to catch the page from a backing fs being unlocked and to wake up another thread to take a copy of it.
LKML-Reference: <[email protected]>
--- include/linux/wait.h | 9 ++++++++- kernel/wait.c | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-)
include/linux/wait.h +8 -1
@@ -77,7 +77,14 @@ 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); +extern void __init_waitqueue_head (wait_queue_head_t *q,struct lock_class_key *); + +#define init_waitqueue_head (q) \ + do { \ + static struct lock_class_key __key; \ + \ + __init_waitqueue_head((q), &__key); \ + } while (0)#ifdef CONFIG_LOCKDEP # define __WAIT_QUEUE_HEAD_INIT_ONSTACK (name) \
kernel/wait.c +3 -2
@@ -10,13 +10,14 @@#include <linux/wait.h> #include <linux/hash.h> -void init_waitqueue_head (wait_queue_head_t *q) +void __init_waitqueue_head (wait_queue_head_t *q,struct lock_class_key *key) {spin_lock_init (&q->lock); +lockdep_set_class (&q->lock, key);INIT_LIST_HEAD (&q->task_list); } -EXPORT_SYMBOL (init_waitqueue_head); +EXPORT_SYMBOL (__init_waitqueue_head);void add_wait_queue (wait_queue_head_t *q,wait_queue_t *wait) {