aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/locking
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/locking')
-rw-r--r--kernel/locking/mutex.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index e4d997bb7d70..11b103d87b27 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -820,6 +820,10 @@ static inline int __mutex_trylock_slowpath(atomic_t *lock_count)
820 unsigned long flags; 820 unsigned long flags;
821 int prev; 821 int prev;
822 822
823 /* No need to trylock if the mutex is locked. */
824 if (mutex_is_locked(lock))
825 return 0;
826
823 spin_lock_mutex(&lock->wait_lock, flags); 827 spin_lock_mutex(&lock->wait_lock, flags);
824 828
825 prev = atomic_xchg(&lock->count, -1); 829 prev = atomic_xchg(&lock->count, -1);