Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1415682
| From | Mike Galbraith <umgwanakikbuti@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [patch rfc] locking/rwsem: Add down_write_killable/killable_nested() |
| Date | 2016-06-07 06:20 +0200 |
| Message-ID | <rHgEF-6cx-3@gated-at.bofh.it> (permalink) |
| References | <rFUPU-21R-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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)
{
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[ANNOUNCE] 4.6.1-rt3 Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-06-03 12:50 +0200
[patch rfc] work-simple: Rename work-simple.[ch] to swork.[ch] for consistency Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-06-05 08:20 +0200
Re: [patch rfc] work-simple: Rename work-simple.[ch] to swork.[ch] for consistency Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-06-06 11:00 +0200
[patch] mm/memcontrol.c::mem_cgroup_migrate() - replace another local_irq_disable() w. local_lock_irq() Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-06-05 08:20 +0200
Re: [patch] mm/memcontrol.c::mem_cgroup_migrate() - replace another local_irq_disable() w. local_lock_irq() Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-06-06 11:00 +0200
[patch rfc] locking/rwsem: Add down_write_killable/killable_nested() Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-06-07 06:20 +0200
Re: [patch rfc] locking/rwsem: Add down_write_killable/killable_nested() Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-06-09 15:10 +0200
csiph-web