diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-06-09 11:43:52 +0200 |
---|---|---|
committer | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-02-13 00:35:39 +0100 |
commit | 0e8a077e94f31e96dfd740d40f758eb943d504d6 (patch) | |
tree | 58adaa3a853eca671a6ed9299a8f119d32cafa55 | |
parent | 9037eb616f21a80232cbdae14f7785df6a273fe5 (diff) | |
download | rt-linux-0e8a077e94f31e96dfd740d40f758eb943d504d6.tar.gz |
rtmutex: Add rtmutex_lock_killable()
Add "killable" type to rtmutex. We need this since rtmutex are used as
"normal" mutexes which do use this type.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/rtmutex.h | 1 | ||||
-rw-r--r-- | kernel/locking/rtmutex.c | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index 1abba5ce2a2f3..51dc12e3860cd 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h @@ -91,6 +91,7 @@ extern void rt_mutex_destroy(struct rt_mutex *lock); extern void rt_mutex_lock(struct rt_mutex *lock); extern int rt_mutex_lock_interruptible(struct rt_mutex *lock); +extern int rt_mutex_lock_killable(struct rt_mutex *lock); extern int rt_mutex_timed_lock(struct rt_mutex *lock, struct hrtimer_sleeper *timeout); diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index f9fa17c6bcb89..532d03f2a666d 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -1467,6 +1467,25 @@ int rt_mutex_timed_futex_lock(struct rt_mutex *lock, } /** + * rt_mutex_lock_killable - lock a rt_mutex killable + * + * @lock: the rt_mutex to be locked + * @detect_deadlock: deadlock detection on/off + * + * Returns: + * 0 on success + * -EINTR when interrupted by a signal + * -EDEADLK when the lock would deadlock (when deadlock detection is on) + */ +int __sched rt_mutex_lock_killable(struct rt_mutex *lock) +{ + might_sleep(); + + return rt_mutex_fastlock(lock, TASK_KILLABLE, rt_mutex_slowlock); +} +EXPORT_SYMBOL_GPL(rt_mutex_lock_killable); + +/** * rt_mutex_timed_lock - lock a rt_mutex interruptible * the timeout structure is provided * by the caller |