···217217 whether the increased speed is worth it.2182182192198. Although synchronize_rcu() is slower than is call_rcu(), it220220- usually results in simpler code. So, unless update performance221221- is critically important or the updaters cannot block,222222- synchronize_rcu() should be used in preference to call_rcu().220220+ usually results in simpler code. So, unless update performance is221221+ critically important, the updaters cannot block, or the latency of222222+ synchronize_rcu() is visible from userspace, synchronize_rcu()223223+ should be used in preference to call_rcu(). Furthermore,224224+ kfree_rcu() usually results in even simpler code than does225225+ synchronize_rcu() without synchronize_rcu()'s multi-millisecond226226+ latency. So please take advantage of kfree_rcu()'s "fire and227227+ forget" memory-freeing capabilities where it applies.223228224229 An especially important property of the synchronize_rcu()225230 primitive is that it automatically self-limits: if grace periods···273268 e. Periodically invoke synchronize_rcu(), permitting a limited274269 number of updates per grace period.275270276276- The same cautions apply to call_rcu_bh() and call_rcu_sched().271271+ The same cautions apply to call_rcu_bh(), call_rcu_sched(),272272+ call_srcu(), and kfree_rcu().2772732782749. All RCU list-traversal primitives, which include279275 rcu_dereference(), list_for_each_entry_rcu(), and···302296 all currently executing rcu_read_lock()-protected RCU read-side303297 critical sections complete. It does -not- necessarily guarantee304298 that all currently running interrupts, NMIs, preempt_disable()305305- code, or idle loops will complete. Therefore, if you do not have306306- rcu_read_lock()-protected read-side critical sections, do -not-307307- use synchronize_rcu().299299+ code, or idle loops will complete. Therefore, if your300300+ read-side critical sections are protected by something other301301+ than rcu_read_lock(), do -not- use synchronize_rcu().308302309303 Similarly, disabling preemption is not an acceptable substitute310304 for rcu_read_lock(). Code that attempts to use preemption···407401 read-side critical sections. It is the responsibility of the408402 RCU update-side primitives to deal with this.409403410410-17. Use CONFIG_PROVE_RCU, CONFIG_DEBUG_OBJECTS_RCU_HEAD, and411411- the __rcu sparse checks to validate your RCU code. These412412- can help find problems as follows:404404+17. Use CONFIG_PROVE_RCU, CONFIG_DEBUG_OBJECTS_RCU_HEAD, and the405405+ __rcu sparse checks (enabled by CONFIG_SPARSE_RCU_POINTER) to406406+ validate your RCU code. These can help find problems as follows:413407414408 CONFIG_PROVE_RCU: check that accesses to RCU-protected data415409 structures are carried out under the proper RCU
+5
Documentation/RCU/lockdep.txt
···6464 but retain the compiler constraints that prevent duplicating6565 or coalescsing. This is useful when when testing the6666 value of the pointer itself, for example, against NULL.6767+ rcu_access_index(idx):6868+ Return the value of the index and omit all barriers, but6969+ retain the compiler constraints that prevent duplicating7070+ or coalescsing. This is useful when when testing the7171+ value of the index itself, for example, against -1.67726873The rcu_dereference_check() check expression can be any boolean6974expression, but would normally include a lockdep expression. However,
+14-1
Documentation/RCU/rcubarrier.txt
···7979 2. Execute rcu_barrier().8080 3. Allow the module to be unloaded.81818282-The rcutorture module makes use of rcu_barrier in its exit function8282+There are also rcu_barrier_bh(), rcu_barrier_sched(), and srcu_barrier()8383+functions for the other flavors of RCU, and you of course must match8484+the flavor of rcu_barrier() with that of call_rcu(). If your module8585+uses multiple flavors of call_rcu(), then it must also use multiple8686+flavors of rcu_barrier() when unloading that module. For example, if8787+it uses call_rcu_bh(), call_srcu() on srcu_struct_1, and call_srcu() on8888+srcu_struct_2(), then the following three lines of code will be required8989+when unloading:9090+9191+ 1 rcu_barrier_bh();9292+ 2 srcu_barrier(&srcu_struct_1);9393+ 3 srcu_barrier(&srcu_struct_2);9494+9595+The rcutorture module makes use of rcu_barrier() in its exit function8396as follows:84978598 1 static void