summaryrefslogtreecommitdiff
path: root/kernel/locking/rtmutex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-03-26 18:29:43 +0300
committerIngo Molnar <mingo@kernel.org>2021-03-29 16:57:04 +0300
commitc2c360ed7f28fd6b7eb7e39e70af2d2ae405f466 (patch)
tree0850b7991410c54c110d923f274ef7f2ab908fb3 /kernel/locking/rtmutex.c
parent82cd5b1039e26b1b1254886464991e34de439ac5 (diff)
downloadlinux-c2c360ed7f28fd6b7eb7e39e70af2d2ae405f466.tar.xz
locking/rtmutex: Restrict the trylock WARN_ON() to debug
The warning as written is expensive and not really required for a production kernel. Make it depend on rt mutex debugging and use !in_task() for the condition which generates far better code and gives the same answer. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20210326153944.436565064@linutronix.de
Diffstat (limited to 'kernel/locking/rtmutex.c')
-rw-r--r--kernel/locking/rtmutex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 512b400bd961..c68542dbbd0a 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1456,7 +1456,7 @@ int __sched rt_mutex_trylock(struct rt_mutex *lock)
{
int ret;
- if (WARN_ON_ONCE(in_irq() || in_nmi() || in_serving_softirq()))
+ if (IS_ENABLED(CONFIG_DEBUG_RT_MUTEXES) && WARN_ON_ONCE(!in_task()))
return 0;
/*