D.3.2.1 Read-Side Critical Sections

Figure: RCU Read-Side Critical Sections
\begin{figure}{ \scriptsize
\begin{verbatim}1 void __rcu_read_lock(void)
2 {...
...25 __release(RCU_BH);
26 local_bh_enable();
27 }\end{verbatim}
}\end{figure}

Figure [*] shows the functions that demark RCU read-side critical sections. Lines 1-6 show __rcu_read_lock(), which begins an ``rcu'' read-side critical section. line 3 disables preemption, line 4 is a sparse marker noting the beginning of an RCU read-side critical section, and line 5 updates lockdep state. Lines 8-13 show __rcu_read_unlock(), which is the inverse of __rcu_read_lock(). Lines 15-20 show __rcu_read_lock_bh() and lines 22-27 show __rcu_read_unlock_bh(), which are analogous to the previous two functions, but disable and enable bottom-half processing rather than preemption.

Quick Quiz D.27: I thought that RCU read-side processing was supposed to be fast! The functions shown in Figure [*] have so much junk in them that they just have to be slow! What gives here? End Quick Quiz



Paul E. McKenney 2011-12-16