Skip to content

Commit

Permalink
locking/rtmutex: Switch to from cmpxchg_*() to try_cmpxchg_*()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Aug 17, 2021
1 parent 7851593 commit 709e0b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/locking/rtmutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit 709e0b6

Please sign in to comment.