History

locking/percpu-rwsem: Add DEFINE_PERCPU_RWSEM(), use it to initialize cgroup_threadgroup_rwsem

Turn DEFINE_STATIC_PERCPU_RWSEM() into __DEFINE_PERCPU_RWSEM() with the additional "is_static" argument to introduce DEFINE_PERCPU_RWSEM(). Change cgroup.c to use DEFINE_PERCPU_RWSEM(cgroup_threadgroup_rwsem).

Oleg Nesterov committed 7 years ago

Commit 3f2947b1 parent 2bf1acc2 files · +7 −4Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/percpu-rwsem.h+6−2
@@ -17,14 +17,18 @@ struct percpu_rw_semaphore { · 16 unmodified lines
17 int readers_block;17 int readers_block;
18};18};
19 19
20#define DEFINE_STATIC_PERCPU_RWSEM(name) \20#define __DEFINE_PERCPU_RWSEM(name, is_static) \
21static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \21static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \
22static struct percpu_rw_semaphore name = { \22is_static struct percpu_rw_semaphore name = { \
23 .rss = __RCU_SYNC_INITIALIZER(name.rss), \23 .rss = __RCU_SYNC_INITIALIZER(name.rss), \
24 .read_count = &__percpu_rwsem_rc_##name, \24 .read_count = &__percpu_rwsem_rc_##name, \
25 .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \25 .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \
26 .writer = __RCUWAIT_INITIALIZER(name.writer), \26 .writer = __RCUWAIT_INITIALIZER(name.writer), \
27}27}
28#define DEFINE_PERCPU_RWSEM(name) \
29 __DEFINE_PERCPU_RWSEM(name, /* not static */)
30#define DEFINE_STATIC_PERCPU_RWSEM(name) \
31 __DEFINE_PERCPU_RWSEM(name, static)
28 32
29extern int __percpu_down_read(struct percpu_rw_semaphore *, int);33extern int __percpu_down_read(struct percpu_rw_semaphore *, int);
30extern void __percpu_up_read(struct percpu_rw_semaphore *);34extern void __percpu_up_read(struct percpu_rw_semaphore *);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t