Changeset 99022de in mainline
- Timestamp:
- 2012-11-23T01:23:17Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a2f42e5
- Parents:
- 0a597d7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/urcu/rcu.c
r0a597d7 r99022de 94 94 typedef struct rcu_data { 95 95 fibril_mutex_t mtx; 96 size_t cur_gp; 96 97 size_t reader_group; 97 98 futex_t list_futex; … … 106 107 static rcu_data_t rcu = { 107 108 .mtx = FIBRIL_MUTEX_INITIALIZER(rcu.mtx), 109 .cur_gp = 0, 108 110 .reader_group = RCU_GROUP_A, 109 111 .list_futex = FUTEX_INITIALIZER, … … 183 185 void rcu_synchronize(void) 184 186 { 187 /* Contain load of rcu.cur_gp. */ 188 memory_barrier(); 189 190 /* Approximately the number of the GP in progress. */ 191 size_t gp_in_progress = ACCESS_ONCE(rcu.cur_gp); 192 193 /* todo: early exit for batched sync()s */ 194 fibril_mutex_lock(&rcu.mtx); 195 196 /* 197 * Exit early if we were stuck waiting for the mutex for a full grace 198 * period. Started waiting during gp_in_progress (or gp_in_progress + 1 199 * if the value propagated to this cpu too late) so wait for the next 200 * full GP, gp_in_progress + 1, to finish. Ie don't wait if the GP 201 * after that, gp_in_progress + 2, already started. 202 */ 203 if (rcu.cur_gp + 2 >= gp_in_progress) { 204 fibril_mutex_unlock(&rcu.mtx); 205 return; 206 } 207 208 ++ACCESS_ONCE(rcu.cur_gp); 209 185 210 /* 186 211 * Pairs up with MB_FORCE_L (ie CC_BAR_L). Makes changes prior … … 188 213 */ 189 214 memory_barrier(); /* MB_A */ 190 191 /* todo: early exit for batched sync()s */192 fibril_mutex_lock(&rcu.mtx);193 215 194 216 /*
Note:
See TracChangeset
for help on using the changeset viewer.