Skip to content

Commit 0454772

Browse files
ldr709Paul E. McKenney
authored andcommitted
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>
1 parent 456a737 commit 0454772

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/locking/mutex-debug.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
3636

3737
void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter)
3838
{
39-
SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));
39+
lockdep_assert_held(&lock->wait_lock);
4040
DEBUG_LOCKS_WARN_ON(list_empty(&lock->wait_list));
4141
DEBUG_LOCKS_WARN_ON(waiter->magic != waiter);
4242
DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list));
@@ -51,7 +51,7 @@ void debug_mutex_free_waiter(struct mutex_waiter *waiter)
5151
void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
5252
struct task_struct *task)
5353
{
54-
SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));
54+
lockdep_assert_held(&lock->wait_lock);
5555

5656
/* Mark the current thread as blocked on the lock: */
5757
task->blocked_on = waiter;

0 commit comments

Comments
 (0)