86 lines
2.9 KiB
Diff
86 lines
2.9 KiB
Diff
Subject: rtmutex-lock-killable.patch
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
|
Date: Thu, 09 Jun 2011 11:43:52 +0200
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/patches-3.10.4-rt1.tar.xz
|
|
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
---
|
|
include/linux/rtmutex.h | 1 +
|
|
kernel/rtmutex.c | 33 +++++++++++++++++++++++++++------
|
|
2 files changed, 28 insertions(+), 6 deletions(-)
|
|
|
|
Index: linux-stable/include/linux/rtmutex.h
|
|
===================================================================
|
|
--- linux-stable.orig/include/linux/rtmutex.h
|
|
+++ linux-stable/include/linux/rtmutex.h
|
|
@@ -90,6 +90,7 @@ extern void rt_mutex_destroy(struct rt_m
|
|
extern void rt_mutex_lock(struct rt_mutex *lock);
|
|
extern int rt_mutex_lock_interruptible(struct rt_mutex *lock,
|
|
int detect_deadlock);
|
|
+extern int rt_mutex_lock_killable(struct rt_mutex *lock, int detect_deadlock);
|
|
extern int rt_mutex_timed_lock(struct rt_mutex *lock,
|
|
struct hrtimer_sleeper *timeout,
|
|
int detect_deadlock);
|
|
Index: linux-stable/kernel/rtmutex.c
|
|
===================================================================
|
|
--- linux-stable.orig/kernel/rtmutex.c
|
|
+++ linux-stable/kernel/rtmutex.c
|
|
@@ -816,12 +816,12 @@ EXPORT_SYMBOL_GPL(rt_mutex_lock);
|
|
/**
|
|
* rt_mutex_lock_interruptible - lock a rt_mutex interruptible
|
|
*
|
|
- * @lock: the rt_mutex to be locked
|
|
+ * @lock: the rt_mutex to be locked
|
|
* @detect_deadlock: deadlock detection on/off
|
|
*
|
|
* Returns:
|
|
- * 0 on success
|
|
- * -EINTR when interrupted by a signal
|
|
+ * 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_interruptible(struct rt_mutex *lock,
|
|
@@ -835,17 +835,38 @@ int __sched rt_mutex_lock_interruptible(
|
|
EXPORT_SYMBOL_GPL(rt_mutex_lock_interruptible);
|
|
|
|
/**
|
|
+ * 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,
|
|
+ int detect_deadlock)
|
|
+{
|
|
+ might_sleep();
|
|
+
|
|
+ return rt_mutex_fastlock(lock, TASK_KILLABLE,
|
|
+ detect_deadlock, 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
|
|
*
|
|
- * @lock: the rt_mutex to be locked
|
|
+ * @lock: the rt_mutex to be locked
|
|
* @timeout: timeout structure or NULL (no timeout)
|
|
* @detect_deadlock: deadlock detection on/off
|
|
*
|
|
* Returns:
|
|
- * 0 on success
|
|
- * -EINTR when interrupted by a signal
|
|
+ * 0 on success
|
|
+ * -EINTR when interrupted by a signal
|
|
* -ETIMEDOUT when the timeout expired
|
|
* -EDEADLK when the lock would deadlock (when deadlock detection is on)
|
|
*/
|