E.8.2 Entering and Leaving Dynticks-Idle Mode

Figure: Entering and Exiting Dynticks-Idle Mode
\begin{figure}{ \scriptsize
\begin{verbatim}1 void rcu_enter_nohz(void)
2 {
...
...
25 local_irq_restore(flags);
26 smp_mb();
27 }\end{verbatim}
}\end{figure}

Figure [*] shows the rcu_enter_nohz() and rcu_exit_nohz(), which enter and exit dynticks-idle mode, also known as ``nohz'' mode. These two functions are invoked from process context.

Line 6 ensures that any prior memory accesses (which might include accesses from RCU read-side critical sections) are seen by other CPUs before those marking entry to dynticks-idle mode. Lines 7 and 12 disable and reenable irqs. Line 8 acquires a pointer to the current CPU's rcu_dynticks structure, and line 9 increments the current CPU's dynticks counter, which should now be even, given that we are entering dynticks-idle mode in process context. Finally, line 10 decrements dynticks_nesting, which should now be zero.

The rcu_exit_nohz() function is quite similar, but increments dynticks_nesting rather than decrementing it and checks for the opposite dynticks polarity.



Paul E. McKenney 2011-12-16