diff options
author | Lance Roy <ldr709@gmail.com> | 2018-10-05 02:45:46 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.ibm.com> | 2018-11-12 12:06:22 -0500 |
commit | 04547728b7b775333a4f6fbb3c55102a79dc4596 (patch) | |
tree | 73563c4df017eed909787753a832c199eea364b2 /kernel/locking/mutex-debug.c | |
parent | 456a737896b25e4853bbf3d6ca5a1c8ee4df4ee9 (diff) |
locking/mutex: Replace spin_is_locked() with lockdep
lockdep_assert_held() is better suited to checking locking requirements,
since it only checks if the current thread holds the lock regardless of
whether someone else does. This is also a step towards possibly removing
spin_is_locked().
Signed-off-by: Lance Roy <ldr709@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Diffstat (limited to 'kernel/locking/mutex-debug.c')
-rw-r--r-- | kernel/locking/mutex-debug.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c index 9aa713629387..771d4ca96dda 100644 --- a/kernel/locking/mutex-debug.c +++ b/kernel/locking/mutex-debug.c | |||
@@ -36,7 +36,7 @@ void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter) | |||
36 | 36 | ||
37 | void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter) | 37 | void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter) |
38 | { | 38 | { |
39 | SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock)); | 39 | lockdep_assert_held(&lock->wait_lock); |
40 | DEBUG_LOCKS_WARN_ON(list_empty(&lock->wait_list)); | 40 | DEBUG_LOCKS_WARN_ON(list_empty(&lock->wait_list)); |
41 | DEBUG_LOCKS_WARN_ON(waiter->magic != waiter); | 41 | DEBUG_LOCKS_WARN_ON(waiter->magic != waiter); |
42 | DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list)); | 42 | DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list)); |
@@ -51,7 +51,7 @@ void debug_mutex_free_waiter(struct mutex_waiter *waiter) | |||
51 | void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter, | 51 | void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
52 | struct task_struct *task) | 52 | struct task_struct *task) |
53 | { | 53 | { |
54 | SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock)); | 54 | lockdep_assert_held(&lock->wait_lock); |
55 | 55 | ||
56 | /* Mark the current thread as blocked on the lock: */ | 56 | /* Mark the current thread as blocked on the lock: */ |
57 | task->blocked_on = waiter; | 57 | task->blocked_on = waiter; |