D.3.8.1 Recording and Recalling Dynticks-Idle Grace Period

Figure: Recording and Recalling Dynticks-Idle Grace Period
\begin{figure}{ \scriptsize
\begin{verbatim}1 static void
2 dyntick_record_c...
...p)
10 {
11 return rsp->dynticks_completed;
12 }\end{verbatim}
}\end{figure}

Figure [*] shows the code for dyntick_record_completed() and dyntick_recall_completed(). These functions are defined as shown only if dynticks is enabled (in other words, the CONFIG_NO_HZ kernel parameter is selected), otherwise they are essentially no-ops. The purpose of these functions is to ensure that a given observation of a CPU in dynticks-idle mode is associated with the correct grace period in face of races between reporting this CPU in dynticks-idle mode and this CPU coming out of dynticks-idle mode and reporting a quiescent state on its own.

Lines 1-6 show dyntick_record_completed(), which stores the value specified by its comp argument into the specified rcu_state structure's ->dynticks_completed field. Lines 8-12 show dyntick_recall_completed(), which returns the value stored by the most recent call to dyntick_record_completed() for this combination of CPU and rcu_state structure.



Paul E. McKenney 2011-12-16