From: Mike Galbraith <umgwanakikbuti@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: [patch rfc] locking/rwsem: Add down_write_killable/killable_nested()
Date: Tue, 07 Jun 2016 06:19:19 +0200 [thread overview]
Message-ID: <1465273159.3931.24.camel@gmail.com> (raw)
In-Reply-To: <20160603104424.GA18975@linutronix.de>
v4.7 added down_write_killable/killable_nested(), add them to -rt.
Signed-off-by: Mike Galbraith <mgalbraith@suse.de>
---
include/linux/rwsem_rt.h | 12 ++++++++++++
kernel/locking/rt.c | 24 ++++++++++++++++++++++++
2 files changed, 36 insertions(+)
--- a/include/linux/rwsem_rt.h
+++ b/include/linux/rwsem_rt.h
@@ -52,8 +52,10 @@ do { \
} while (0)
extern void rt_down_write(struct rw_semaphore *rwsem);
+extern int __must_check rt_down_write_killable(struct rw_semaphore *rwsem);
extern void rt_down_read_nested(struct rw_semaphore *rwsem, int subclass);
extern void rt_down_write_nested(struct rw_semaphore *rwsem, int subclass);
+extern int __must_check rt_down_write_killable_nested(struct rw_semaphore *rwsem, int subclass);
extern void rt_down_write_nested_lock(struct rw_semaphore *rwsem,
struct lockdep_map *nest);
extern void rt__down_read(struct rw_semaphore *rwsem);
@@ -100,6 +102,11 @@ static inline void down_write(struct rw_
rt_down_write(sem);
}
+static inline int down_write_killable(struct rw_semaphore *sem)
+{
+ return rt_down_write_killable(sem);
+}
+
static inline int down_write_trylock(struct rw_semaphore *sem)
{
return rt_down_write_trylock(sem);
@@ -134,6 +141,11 @@ static inline void down_write_nested(str
{
rt_down_write_nested(sem, subclass);
}
+
+static inline int down_write_killable_nested(struct rw_semaphore *sem, int subclass)
+{
+ return rt_down_write_killable_nested(sem, subclass);
+}
#ifdef CONFIG_DEBUG_LOCK_ALLOC
static inline void down_write_nest_lock(struct rw_semaphore *sem,
struct rw_semaphore *nest_lock)
--- a/kernel/locking/rt.c
+++ b/kernel/locking/rt.c
@@ -358,6 +358,18 @@ void rt_down_write(struct rw_semaphore
}
EXPORT_SYMBOL(rt_down_write);
+int rt_down_write_killable(struct rw_semaphore *rwsem)
+{
+ int ret;
+
+ rwsem_acquire(&rwsem->dep_map, 0, 0, _RET_IP_);
+ ret = rt_mutex_lock_killable(&rwsem->lock);
+ if (ret)
+ rwsem_release(&rwsem->dep_map, 1, _RET_IP_);
+ return ret;
+}
+EXPORT_SYMBOL(rt_down_write_killable);
+
void rt_down_write_nested(struct rw_semaphore *rwsem, int subclass)
{
rwsem_acquire(&rwsem->dep_map, subclass, 0, _RET_IP_);
@@ -365,6 +377,18 @@ void rt_down_write_nested(struct rw_sem
}
EXPORT_SYMBOL(rt_down_write_nested);
+int rt_down_write_killable_nested(struct rw_semaphore *rwsem, int subclass)
+{
+ int ret;
+
+ rwsem_acquire(&rwsem->dep_map, subclass, 0, _RET_IP_);
+ ret = rt_mutex_lock_killable(&rwsem->lock);
+ if (ret)
+ rwsem_release(&rwsem->dep_map, 1, _RET_IP_);
+ return ret;
+}
+EXPORT_SYMBOL(rt_down_write_killable_nested);
+
void rt_down_write_nested_lock(struct rw_semaphore *rwsem,
struct lockdep_map *nest)
{
next prev parent reply other threads:[~2016-06-07 4:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 10:44 [ANNOUNCE] 4.6.1-rt3 Sebastian Andrzej Siewior
2016-06-05 6:11 ` [patch] mm/memcontrol.c::mem_cgroup_migrate() - replace another local_irq_disable() w. local_lock_irq() Mike Galbraith
2016-06-06 8:52 ` Sebastian Andrzej Siewior
2016-06-05 6:16 ` [patch rfc] work-simple: Rename work-simple.[ch] to swork.[ch] for consistency Mike Galbraith
2016-06-06 8:52 ` Sebastian Andrzej Siewior
2016-06-07 4:19 ` Mike Galbraith [this message]
2016-06-09 13:06 ` [patch rfc] locking/rwsem: Add down_write_killable/killable_nested() Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465273159.3931.24.camel@gmail.com \
--to=umgwanakikbuti@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.