aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/RCU
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-03-04 20:55:49 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-03-12 17:09:02 -0400
commit3f944adb9d1ca912902783e7aede2a5b5c19a605 (patch)
tree2ab5039926992d2497f7ba626f2e10c3666ca351 /Documentation/RCU
parent4357fb570b3709c145384065d04b698a30dc722e (diff)
rcu: Documentation update
This commit applies a few updates based on a quick review of the RCU documentations. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'Documentation/RCU')
-rw-r--r--Documentation/RCU/checklist.txt26
-rw-r--r--Documentation/RCU/lockdep.txt5
-rw-r--r--Documentation/RCU/rcubarrier.txt15
3 files changed, 35 insertions, 11 deletions
diff --git a/Documentation/RCU/checklist.txt b/Documentation/RCU/checklist.txt
index 31ef8fe07f82..79e789b8b8ea 100644
--- a/Documentation/RCU/checklist.txt
+++ b/Documentation/RCU/checklist.txt
@@ -217,9 +217,14 @@ over a rather long period of time, but improvements are always welcome!
217 whether the increased speed is worth it. 217 whether the increased speed is worth it.
218 218
2198. Although synchronize_rcu() is slower than is call_rcu(), it 2198. Although synchronize_rcu() is slower than is call_rcu(), it
220 usually results in simpler code. So, unless update performance 220 usually results in simpler code. So, unless update performance is
221 is critically important or the updaters cannot block, 221 critically important, the updaters cannot block, or the latency of
222 synchronize_rcu() should be used in preference to call_rcu(). 222 synchronize_rcu() is visible from userspace, synchronize_rcu()
223 should be used in preference to call_rcu(). Furthermore,
224 kfree_rcu() usually results in even simpler code than does
225 synchronize_rcu() without synchronize_rcu()'s multi-millisecond
226 latency. So please take advantage of kfree_rcu()'s "fire and
227 forget" memory-freeing capabilities where it applies.
223 228
224 An especially important property of the synchronize_rcu() 229 An especially important property of the synchronize_rcu()
225 primitive is that it automatically self-limits: if grace periods 230 primitive is that it automatically self-limits: if grace periods
@@ -268,7 +273,8 @@ over a rather long period of time, but improvements are always welcome!
268 e. Periodically invoke synchronize_rcu(), permitting a limited 273 e. Periodically invoke synchronize_rcu(), permitting a limited
269 number of updates per grace period. 274 number of updates per grace period.
270 275
271 The same cautions apply to call_rcu_bh() and call_rcu_sched(). 276 The same cautions apply to call_rcu_bh(), call_rcu_sched(),
277 call_srcu(), and kfree_rcu().
272 278
2739. All RCU list-traversal primitives, which include 2799. All RCU list-traversal primitives, which include
274 rcu_dereference(), list_for_each_entry_rcu(), and 280 rcu_dereference(), list_for_each_entry_rcu(), and
@@ -296,9 +302,9 @@ over a rather long period of time, but improvements are always welcome!
296 all currently executing rcu_read_lock()-protected RCU read-side 302 all currently executing rcu_read_lock()-protected RCU read-side
297 critical sections complete. It does -not- necessarily guarantee 303 critical sections complete. It does -not- necessarily guarantee
298 that all currently running interrupts, NMIs, preempt_disable() 304 that all currently running interrupts, NMIs, preempt_disable()
299 code, or idle loops will complete. Therefore, if you do not have 305 code, or idle loops will complete. Therefore, if your
300 rcu_read_lock()-protected read-side critical sections, do -not- 306 read-side critical sections are protected by something other
301 use synchronize_rcu(). 307 than rcu_read_lock(), do -not- use synchronize_rcu().
302 308
303 Similarly, disabling preemption is not an acceptable substitute 309 Similarly, disabling preemption is not an acceptable substitute
304 for rcu_read_lock(). Code that attempts to use preemption 310 for rcu_read_lock(). Code that attempts to use preemption
@@ -401,9 +407,9 @@ over a rather long period of time, but improvements are always welcome!
401 read-side critical sections. It is the responsibility of the 407 read-side critical sections. It is the responsibility of the
402 RCU update-side primitives to deal with this. 408 RCU update-side primitives to deal with this.
403 409
40417. Use CONFIG_PROVE_RCU, CONFIG_DEBUG_OBJECTS_RCU_HEAD, and 41017. Use CONFIG_PROVE_RCU, CONFIG_DEBUG_OBJECTS_RCU_HEAD, and the
405 the __rcu sparse checks to validate your RCU code. These 411 __rcu sparse checks (enabled by CONFIG_SPARSE_RCU_POINTER) to
406 can help find problems as follows: 412 validate your RCU code. These can help find problems as follows:
407 413
408 CONFIG_PROVE_RCU: check that accesses to RCU-protected data 414 CONFIG_PROVE_RCU: check that accesses to RCU-protected data
409 structures are carried out under the proper RCU 415 structures are carried out under the proper RCU
diff --git a/Documentation/RCU/lockdep.txt b/Documentation/RCU/lockdep.txt
index a102d4b3724b..cd83d2348fef 100644
--- a/Documentation/RCU/lockdep.txt
+++ b/Documentation/RCU/lockdep.txt
@@ -64,6 +64,11 @@ checking of rcu_dereference() primitives:
64 but retain the compiler constraints that prevent duplicating 64 but retain the compiler constraints that prevent duplicating
65 or coalescsing. This is useful when when testing the 65 or coalescsing. This is useful when when testing the
66 value of the pointer itself, for example, against NULL. 66 value of the pointer itself, for example, against NULL.
67 rcu_access_index(idx):
68 Return the value of the index and omit all barriers, but
69 retain the compiler constraints that prevent duplicating
70 or coalescsing. This is useful when when testing the
71 value of the index itself, for example, against -1.
67 72
68The rcu_dereference_check() check expression can be any boolean 73The rcu_dereference_check() check expression can be any boolean
69expression, but would normally include a lockdep expression. However, 74expression, but would normally include a lockdep expression. However,
diff --git a/Documentation/RCU/rcubarrier.txt b/Documentation/RCU/rcubarrier.txt
index 38428c125135..2e319d1b9ef2 100644
--- a/Documentation/RCU/rcubarrier.txt
+++ b/Documentation/RCU/rcubarrier.txt
@@ -79,7 +79,20 @@ complete. Pseudo-code using rcu_barrier() is as follows:
79 2. Execute rcu_barrier(). 79 2. Execute rcu_barrier().
80 3. Allow the module to be unloaded. 80 3. Allow the module to be unloaded.
81 81
82The rcutorture module makes use of rcu_barrier in its exit function 82There are also rcu_barrier_bh(), rcu_barrier_sched(), and srcu_barrier()
83functions for the other flavors of RCU, and you of course must match
84the flavor of rcu_barrier() with that of call_rcu(). If your module
85uses multiple flavors of call_rcu(), then it must also use multiple
86flavors of rcu_barrier() when unloading that module. For example, if
87it uses call_rcu_bh(), call_srcu() on srcu_struct_1, and call_srcu() on
88srcu_struct_2(), then the following three lines of code will be required
89when unloading:
90
91 1 rcu_barrier_bh();
92 2 srcu_barrier(&srcu_struct_1);
93 3 srcu_barrier(&srcu_struct_2);
94
95The rcutorture module makes use of rcu_barrier() in its exit function
83as follows: 96as follows:
84 97
85 1 static void 98 1 static void