0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_RCU_SYNC_H_
0011 #define _LINUX_RCU_SYNC_H_
0012
0013 #include <linux/wait.h>
0014 #include <linux/rcupdate.h>
0015
0016
0017 struct rcu_sync {
0018 int gp_state;
0019 int gp_count;
0020 wait_queue_head_t gp_wait;
0021
0022 struct rcu_head cb_head;
0023 };
0024
0025
0026
0027
0028
0029
0030
0031
0032 static inline bool rcu_sync_is_idle(struct rcu_sync *rsp)
0033 {
0034 RCU_LOCKDEP_WARN(!rcu_read_lock_any_held(),
0035 "suspicious rcu_sync_is_idle() usage");
0036 return !READ_ONCE(rsp->gp_state);
0037 }
0038
0039 extern void rcu_sync_init(struct rcu_sync *);
0040 extern void rcu_sync_enter_start(struct rcu_sync *);
0041 extern void rcu_sync_enter(struct rcu_sync *);
0042 extern void rcu_sync_exit(struct rcu_sync *);
0043 extern void rcu_sync_dtor(struct rcu_sync *);
0044
0045 #define __RCU_SYNC_INITIALIZER(name) { \
0046 .gp_state = 0, \
0047 .gp_count = 0, \
0048 .gp_wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.gp_wait), \
0049 }
0050
0051 #define DEFINE_RCU_SYNC(name) \
0052 struct rcu_sync name = __RCU_SYNC_INITIALIZER(name)
0053
0054 #endif