57
57
#define RCU_VOLATILE(type, lvalue) \
58
58
(*((type volatile *) &(lvalue)))
61
// FIXME: Shouldn't this be atomic_count_t?
60
62
typedef uint32_t gp_t;
62
64
/* Forward declaration */
72
74
typedef struct rcu {
73
struct rcu *next; /* Next in the chain of callbacks */
74
rcu_cb_t func; /* Callback function to invoke */
75
rcu_cb_type_t type; /* Callback type (default/exclusive) */
76
atomic_t weight; /* Callback importance estimate */
77
rcu_cb_t func; /* Callback function to invoke */
78
rcu_cb_type_t type; /* Callback type (default/exclusive) */
79
atomic_count_t weight; /* Callback importance estimate */
80
83
mutex_t lock; /* Reclaimer exclusivity */
81
84
struct thread *reclaimer; /* Reclaimer thread */
82
struct cpu *relay_cpu; /* Used when CPU in motion */
85
* Fields used by readers, writers and per CPU reclaimer threads.
87
* Fields used by readers, writers and per-CPU reclaimer threads.
87
89
semaphore_t queue_sema; /* Wakes up the reclaimer */
88
rcu_t *nextlist; /* Callbacks waiting for the next GP */
89
rcu_t **nexttail; /* Next GP list tail reference */
90
rcu_t *curlist; /* Callbacks waiting for this GP */
91
rcu_t **curtail; /* Current GP list tail reference */
92
atomic_t weight; /* Current weight of the whole queue */
93
uint32_t nesting; /* Nesting level of read locks */
94
gp_t gp_ctr; /* Local (observed) GP counter */
95
atomic_t *sync; /* Request to synchronize callbacks */
90
list_t curlist; /* Callbacks waiting for this GP */
91
list_t nextlist; /* Callbacks waiting for the next GP */
93
atomic_t weight; /* Current weight of the whole queue */
94
uint32_t nesting; /* Nesting level of read locks */
95
gp_t gp_ctr; /* Local (observed) GP counter */
96
atomic_t *sync; /* Request to synchronize callbacks */
98
99
* Fields used by the detector thread.
134
135
extern void rcu_read_unlock(void);
135
136
extern void rcu_call(rcu_cb_t callb, rcu_t *, atomic_count_t);
136
137
extern void rcu_call_excl(rcu_cb_t, rcu_t *, atomic_count_t);
137
extern void rcu_call_high(rcu_cb_t, rcu_t *, atomic_count_t);
138
extern void rcu_call_excl_high(rcu_cb_t, rcu_t *, atomic_count_t);
139
138
extern void rcu_synchronize(void);
140
139
extern void rcu_synchronize_shared(uint32_t);
141
140
extern void rcu_call_synchronize(void);