However, if a CPU is in dyntick-idle mode, it is in that mode
-for all flavors of RCU.
-Therefore, a single rcu_dynticks structure is allocated per
-CPU, and all of a given CPU's rcu_data structures share
-that rcu_dynticks, as shown in the figure.
+RCU uses the dynticks related fields in the rcu_data structure
+to track which CPUs are in dyntick idle mode.
Kernels built with CONFIG_PREEMPT_RCU support
rcu_preempt in addition to rcu_sched and rcu_bh, as shown below:
@@ -216,9 +206,6 @@ its own synchronization:
Each rcu_node structure has a spinlock.
The fields in rcu_data are private to the corresponding
CPU, although a few can be read and written by other CPUs.
-
Similarly, the fields in rcu_dynticks are private
- to the corresponding CPU, although a few can be read by
- other CPUs.
It is important to note that different data structures can have
@@ -274,11 +261,6 @@ follows:
access to this information from the corresponding CPU.
Finally, this structure records past dyntick-idle state
for the corresponding CPU and also tracks statistics.
-
rcu_dynticks:
- This per-CPU structure tracks the current dyntick-idle
- state for the corresponding CPU.
- Unlike the other three structures, the rcu_dynticks
- structure is not replicated per RCU flavor.
rcu_head:
This structure represents RCU callbacks, and is the
only structure allocated and managed by RCU users.
@@ -289,8 +271,8 @@ follows:
If all you wanted from this article was a general notion of how
RCU's data structures are related, you are done.
Otherwise, each of the following sections give more details on
-the rcu_state, rcu_node, rcu_data,
-and rcu_dynticks data structures.
+the rcu_state, rcu_node and rcu_data data
+structures.
The ->cpu field contains the number of the
-corresponding CPU, the ->rsp pointer references
-the corresponding rcu_state structure (and is most frequently
-used to locate the name of the corresponding flavor of RCU for tracing),
-and the ->mynode field references the corresponding
-rcu_node structure.
+corresponding CPU and the ->mynode field references the
+corresponding rcu_node structure.
The ->mynode is used to propagate quiescent states
up the combining tree.
-
The ->dynticks pointer references the
-rcu_dynticks structure corresponding to this
-CPU.
-Recall that a single per-CPU instance of the rcu_dynticks
-structure is shared among all flavors of RCU.
-These first four fields are constant and therefore require not
-synchronization.
+These two fields are constant and therefore do not require synchronization.
-
The ->grpmask field indicates the bit in
+
The ->grpmask field indicates the bit in
the ->mynode->qsmask corresponding to this
rcu_data structure, and is also used when propagating
quiescent states.
@@ -1181,26 +1152,22 @@ Finally, the ->dynticks_fqs field is used to
count the number of times this CPU is determined to be in
dyntick-idle state, and is used for tracing and debugging purposes.
-
The rcu_dynticks maintains the per-CPU dyntick-idle state
-for the corresponding CPU.
-Unlike the other structures, rcu_dynticks is not
-replicated over the different flavors of RCU.
-The fields in this structure may be accessed only from the corresponding
-CPU (and from tracing) unless otherwise stated.
-Its fields are as follows:
+
+This portion of the rcu_data structure is declared as follows:
1 long dynticks_nesting;
2 long dynticks_nmi_nesting;
3 atomic_t dynticks;
4 bool rcu_need_heavy_qs;
- 5 unsigned long rcu_qs_ctr;
- 6 bool rcu_urgent_qs;
+ 5 bool rcu_urgent_qs;
+
These fields in the rcu_data structure maintain the per-CPU dyntick-idle
+state for the corresponding CPU.
+The fields may be accessed only from the corresponding CPU (and from tracing)
+unless otherwise stated.
+
The ->dynticks_nesting field counts the
nesting depth of process execution, so that in normal circumstances
this counter has value zero or one.
@@ -1242,19 +1209,12 @@ it is willing to call for heavy-weight dyntick-counter operations.
This flag is checked by RCU's context-switch and cond_resched()
code, which provide a momentary idle sojourn in response.
-
The ->rcu_qs_ctr field is used to record
-quiescent states from cond_resched().
-Because cond_resched() can execute quite frequently, this
-must be quite lightweight, as in a non-atomic increment of this
-per-CPU field.
-
Finally, the ->rcu_urgent_qs field is used to record
-the fact that the RCU core code would really like to see a quiescent
-state from the corresponding CPU, with the various other fields indicating
-just how badly RCU wants this quiescent state.
-This flag is checked by RCU's context-switch and cond_resched()
-code, which, if nothing else, non-atomically increment ->rcu_qs_ctr
-in response.
+the fact that the RCU core code would really like to see a quiescent state from
+the corresponding CPU, with the various other fields indicating just how badly
+RCU wants this quiescent state.
+This flag is checked by RCU's context-switch path
+(rcu_note_context_switch) and the cond_resched code.
@@ -1431,7 +1391,7 @@ So each flavor of RCU is represented by an rcu_state structure,
which contains a combining tree of rcu_node and
rcu_data structures.
Finally, in CONFIG_NO_HZ_IDLE kernels, each CPU's dyntick-idle
-state is tracked by an rcu_dynticks structure.
+state is tracked by dynticks-related fields in the rcu_data structure.
If you made it this far, you are well prepared to read the code
walkthroughs in the other articles in this series.
--
2.17.1