diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2021-03-26 16:29:43 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2021-03-29 15:57:04 +0200 |
commit | c2c360ed7f28fd6b7eb7e39e70af2d2ae405f466 (patch) | |
tree | 0850b7991410c54c110d923f274ef7f2ab908fb3 | |
parent | 82cd5b1039e26b1b1254886464991e34de439ac5 (diff) |
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
-rw-r--r-- | kernel/locking/rtmutex.c | 2 |
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; /* |