lkml.org 
[lkml]   [2021]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 10/63] rtmutex: Switch to try_cmpxchg()
From: Thomas Gleixner <tglx@linutronix.de>

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>
---
kernel/locking/rtmutex.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -145,14 +145,14 @@ static __always_inline bool rt_mutex_cmp
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);
}

/*
\
 
 \ /
  Last update: 2021-07-30 16:24    [W:0.328 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site