diff options
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r-- | include/linux/rcupdate.h | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index e3d37efe2703..839d296a7ac0 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -184,12 +184,12 @@ static inline int rcu_read_lock_sched_held(void) | |||
184 | ({ \ | 184 | ({ \ |
185 | if (debug_locks) \ | 185 | if (debug_locks) \ |
186 | WARN_ON_ONCE(!(c)); \ | 186 | WARN_ON_ONCE(!(c)); \ |
187 | rcu_dereference(p); \ | 187 | rcu_dereference_raw(p); \ |
188 | }) | 188 | }) |
189 | 189 | ||
190 | #else /* #ifdef CONFIG_PROVE_RCU */ | 190 | #else /* #ifdef CONFIG_PROVE_RCU */ |
191 | 191 | ||
192 | #define rcu_dereference_check(p, c) rcu_dereference(p) | 192 | #define rcu_dereference_check(p, c) rcu_dereference_raw(p) |
193 | 193 | ||
194 | #endif /* #else #ifdef CONFIG_PROVE_RCU */ | 194 | #endif /* #else #ifdef CONFIG_PROVE_RCU */ |
195 | 195 | ||
@@ -325,22 +325,49 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
325 | 325 | ||
326 | 326 | ||
327 | /** | 327 | /** |
328 | * rcu_dereference - fetch an RCU-protected pointer in an | 328 | * rcu_dereference_raw - fetch an RCU-protected pointer |
329 | * RCU read-side critical section. This pointer may later | 329 | * |
330 | * be safely dereferenced. | 330 | * The caller must be within some flavor of RCU read-side critical |
331 | * section, or must be otherwise preventing the pointer from changing, | ||
332 | * for example, by holding an appropriate lock. This pointer may later | ||
333 | * be safely dereferenced. It is the caller's responsibility to have | ||
334 | * done the right thing, as this primitive does no checking of any kind. | ||
331 | * | 335 | * |
332 | * Inserts memory barriers on architectures that require them | 336 | * Inserts memory barriers on architectures that require them |
333 | * (currently only the Alpha), and, more importantly, documents | 337 | * (currently only the Alpha), and, more importantly, documents |
334 | * exactly which pointers are protected by RCU. | 338 | * exactly which pointers are protected by RCU. |
335 | */ | 339 | */ |
336 | 340 | #define rcu_dereference_raw(p) ({ \ | |
337 | #define rcu_dereference(p) ({ \ | ||
338 | typeof(p) _________p1 = ACCESS_ONCE(p); \ | 341 | typeof(p) _________p1 = ACCESS_ONCE(p); \ |
339 | smp_read_barrier_depends(); \ | 342 | smp_read_barrier_depends(); \ |
340 | (_________p1); \ | 343 | (_________p1); \ |
341 | }) | 344 | }) |
342 | 345 | ||
343 | /** | 346 | /** |
347 | * rcu_dereference - fetch an RCU-protected pointer, checking for RCU | ||
348 | * | ||
349 | * Makes rcu_dereference_check() do the dirty work. | ||
350 | */ | ||
351 | #define rcu_dereference(p) \ | ||
352 | rcu_dereference_check(p, rcu_read_lock_held()) | ||
353 | |||
354 | /** | ||
355 | * rcu_dereference_bh - fetch an RCU-protected pointer, checking for RCU-bh | ||
356 | * | ||
357 | * Makes rcu_dereference_check() do the dirty work. | ||
358 | */ | ||
359 | #define rcu_dereference_bh(p) \ | ||
360 | rcu_dereference_check(p, rcu_read_lock_bh_held()) | ||
361 | |||
362 | /** | ||
363 | * rcu_dereference_sched - fetch RCU-protected pointer, checking for RCU-sched | ||
364 | * | ||
365 | * Makes rcu_dereference_check() do the dirty work. | ||
366 | */ | ||
367 | #define rcu_dereference_sched(p) \ | ||
368 | rcu_dereference_check(p, rcu_read_lock_sched_held()) | ||
369 | |||
370 | /** | ||
344 | * rcu_assign_pointer - assign (publicize) a pointer to a newly | 371 | * rcu_assign_pointer - assign (publicize) a pointer to a newly |
345 | * initialized structure that will be dereferenced by RCU read-side | 372 | * initialized structure that will be dereferenced by RCU read-side |
346 | * critical sections. Returns the value assigned. | 373 | * critical sections. Returns the value assigned. |