lkml.org 
[lkml]   [2011]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/3] rtmutex: introduce rt_mutex_lock_irqdisabled()
Since we permit rt_mutex_lock() to be called with irq disabled
in commit 5342e269, and we will call might_sleep() in
rt_mutex_lock() unconditionally, false positive will be
made. So introduce rt_mutex_lock_irqdisabled() for that kind
of usage.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
---
include/linux/rtmutex.h | 1 +
kernel/rtmutex.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index de17134..0732a25 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -88,6 +88,7 @@ extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
extern void rt_mutex_destroy(struct rt_mutex *lock);

extern void rt_mutex_lock(struct rt_mutex *lock);
+extern void rt_mutex_lock_irqdisabled(struct rt_mutex *lock);
extern int rt_mutex_lock_interruptible(struct rt_mutex *lock,
int detect_deadlock);
extern int rt_mutex_timed_lock(struct rt_mutex *lock,
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index f9d8482..961a100 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -797,6 +797,19 @@ void __sched rt_mutex_lock(struct rt_mutex *lock)
EXPORT_SYMBOL_GPL(rt_mutex_lock);

/**
+ * rt_mutex_lock_irqdisabled - lock a rt_mutex with irq disabled
+ *
+ * @lock: the rt_mutex to be locked
+ */
+void __sched rt_mutex_lock_irqdisabled(struct rt_mutex *lock)
+{
+ might_sleep_irqdisabled();
+
+ rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, 0, rt_mutex_slowlock);
+}
+EXPORT_SYMBOL_GPL(rt_mutex_lock_irqdisabled);
+
+/**
* rt_mutex_lock_interruptible - lock a rt_mutex interruptible
*
* @lock: the rt_mutex to be locked
--
1.7.5.4


\
 
 \ /
  Last update: 2011-12-06 04:31    [W:0.094 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site