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
1717 int readers_block;
1818 };
1919
20−#define DEFINE_STATIC_PERCPU_RWSEM(name) \
20+#define __DEFINE_PERCPU_RWSEM(name, is_static) \
2121 static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \
22−static struct percpu_rw_semaphore name = { \
22+is_static struct percpu_rw_semaphore name = { \
2323 .rss = __RCU_SYNC_INITIALIZER(name.rss), \
2424 .read_count = &__percpu_rwsem_rc_##name, \
2525 .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \
2626 .writer = __RCUWAIT_INITIALIZER(name.writer), \
2727 }
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)
2832
2933 extern int __percpu_down_read(struct percpu_rw_semaphore *, int);
3034 extern 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