lkml.org 
[lkml]   [2015]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC][PATCH 08/13] percpu-rwsem: DEFINE_STATIC_PERCPU_RWSEM
Provide a static init

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/percpu-rwsem.h | 13 +++++++++++++
1 file changed, 13 insertions(+)

--- a/include/linux/percpu-rwsem.h
+++ b/include/linux/percpu-rwsem.h
@@ -16,6 +16,19 @@ struct percpu_rw_semaphore {
struct rw_semaphore rw_sem;
};

+#define DEFINE_STATIC_PERCPU_RWSEM(name) \
+static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_refcount_##name); \
+static struct percpu_rw_semaphore name = { \
+ .refcount = &__percpu_rwsem_refcount_##name, \
+ .state = 0, \
+ .rss = __RCU_SYNC_INITIALIZER(name.rss, RCU_SCHED_SYNC), \
+ .writer = __WAIT_QUEUE_HEAD_INITIALIZER(name.writer), \
+ .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \
+}
+
+#define lockdep_assert_held_percpu_rwsem(sem) \
+ lockdep_assert_held(&(sem)->rw_sem)
+
extern void __percpu_down_read(struct percpu_rw_semaphore *);
extern bool __percpu_down_read_trylock(struct percpu_rw_semaphore *);
extern void __percpu_up_read(struct percpu_rw_semaphore *);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2015-06-22 14:41    [W:0.223 / U:3.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site