locking/rtmutex: Switch to from cmpxchg_*() to try_cmpxchg_*()
authorThomas Gleixner <tglx@linutronix.de>
Sun, 15 Aug 2021 21:27:55 +0000 (23:27 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 17 Aug 2021 15:01:47 +0000 (17:01 +0200)
Allows the compiler to generate better code depending on the architecture.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210815211302.668958502@linutronix.de
kernel/locking/rtmutex.c

index 5187add..98f06c5 100644 (file)
@@ -145,14 +145,14 @@ static __always_inline bool rt_mutex_cmpxchg_acquire(struct rt_mutex *lock,
                                                     struct task_struct *old,
                                                     struct task_struct *new)
 {
-       return cmpxchg_acquire(&lock->owner, old, new) == old;
+       return try_cmpxchg_acquire(&lock->owner, &old, new);
 }
 
 static __always_inline bool rt_mutex_cmpxchg_release(struct rt_mutex *lock,
                                                     struct task_struct *old,
                                                     struct task_struct *new)
 {
-       return cmpxchg_release(&lock->owner, old, new) == old;
+       return try_cmpxchg_release(&lock->owner, &old, new);
 }
 
 /*