locking/rtmutex: Avoid unconditional slowpath for DEBUG_RT_MUTEXES
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Fri, 8 Sep 2023 16:22:49 +0000 (18:22 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 20 Sep 2023 07:31:11 +0000 (09:31 +0200)
commitaf9f006393b53409be0ca83ae234bef840cdef4a
tree7509dc170b32f89e48ad6fc980bddfe4ac540484
parent28bc55f654de49f6122c7475b01b5d5ef4bdf0d4
locking/rtmutex: Avoid unconditional slowpath for DEBUG_RT_MUTEXES

With DEBUG_RT_MUTEXES enabled the fast-path rt_mutex_cmpxchg_acquire()
always fails and all lock operations take the slow path.

Provide a new helper inline rt_mutex_try_acquire() which maps to
rt_mutex_cmpxchg_acquire() in the non-debug case. For the debug case
it invokes rt_mutex_slowtrylock() which can acquire a non-contended
rtmutex under full debug coverage.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20230908162254.999499-3-bigeasy@linutronix.de
kernel/locking/rtmutex.c
kernel/locking/ww_rt_mutex.c