From: Thomas Gleixner Date: Sun, 15 Aug 2021 21:27:55 +0000 (+0200) Subject: locking/rtmutex: Switch to from cmpxchg_*() to try_cmpxchg_*() X-Git-Tag: v5.15-rc1~119^2~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=709e0b62869f625afd18edd79f190c38cb39dfb2;p=thirdparty%2Fkernel%2Flinux.git locking/rtmutex: Switch to from cmpxchg_*() to try_cmpxchg_*() Allows the compiler to generate better code depending on the architecture. Suggested-by: Peter Zijlstra Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20210815211302.668958502@linutronix.de --- diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 5187added8bce..98f06c509f023 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -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); } /*