aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/locking/rtmutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/locking/rtmutex.c')
-rw-r--r--kernel/locking/rtmutex.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index b025295f4966..30ec5b46cd8c 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -70,10 +70,10 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock)
70} 70}
71 71
72/* 72/*
73 * We can speed up the acquire/release, if the architecture 73 * We can speed up the acquire/release, if there's no debugging state to be
74 * supports cmpxchg and if there's no debugging state to be set up 74 * set up.
75 */ 75 */
76#if defined(__HAVE_ARCH_CMPXCHG) && !defined(CONFIG_DEBUG_RT_MUTEXES) 76#ifndef CONFIG_DEBUG_RT_MUTEXES
77# define rt_mutex_cmpxchg(l,c,n) (cmpxchg(&l->owner, c, n) == c) 77# define rt_mutex_cmpxchg(l,c,n) (cmpxchg(&l->owner, c, n) == c)
78static inline void mark_rt_mutex_waiters(struct rt_mutex *lock) 78static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
79{ 79{
@@ -1443,10 +1443,17 @@ EXPORT_SYMBOL_GPL(rt_mutex_timed_lock);
1443 * 1443 *
1444 * @lock: the rt_mutex to be locked 1444 * @lock: the rt_mutex to be locked
1445 * 1445 *
1446 * This function can only be called in thread context. It's safe to
1447 * call it from atomic regions, but not from hard interrupt or soft
1448 * interrupt context.
1449 *
1446 * Returns 1 on success and 0 on contention 1450 * Returns 1 on success and 0 on contention
1447 */ 1451 */
1448int __sched rt_mutex_trylock(struct rt_mutex *lock) 1452int __sched rt_mutex_trylock(struct rt_mutex *lock)
1449{ 1453{
1454 if (WARN_ON(in_irq() || in_nmi() || in_serving_softirq()))
1455 return 0;
1456
1450 return rt_mutex_fasttrylock(lock, rt_mutex_slowtrylock); 1457 return rt_mutex_fasttrylock(lock, rt_mutex_slowtrylock);
1451} 1458}
1452EXPORT_SYMBOL_GPL(rt_mutex_trylock); 1459EXPORT_SYMBOL_GPL(rt_mutex_trylock);