Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4107913imm;
Tue, 25 Sep 2018 11:27:03 -0700 (PDT)
X-Google-Smtp-Source: ACcGV63j9nNP9KMRSUZ0AC4CSXkDBOjKBADXH3bpMNO+WwDnDaizXQO7GjJEEIG/5c7peTz/V0vI
X-Received: by 2002:a17:902:1121:: with SMTP id d30-v6mr2293972pla.250.1537900023091;
Tue, 25 Sep 2018 11:27:03 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1537900023; cv=none;
d=google.com; s=arc-20160816;
b=f2cZ41IYmCwNc/Sd7znU8dpMexX2hLNyQC/ZqfQbPlsLD+rLsnNRMSWtbrlj//ELXC
sNBIkZsyT5Yut2ECb9q3rglcnXDcE/MhrCIxESWea0icTPWC1aIdjXnnS/IoPgSTOpzz
n33W4lWz/iOilDVdGEnPnE/js+scK33Hq1WyIkk4jBsN8iMYmFxWFgVaMxceeEygrAx4
HrjKVqXiNm4I7XZtTHG8Ma5VtuSRwslywGUptsM/ta8vgziqsx4vPvONnFnCYRqtqOdU
Vetsny+Y7IkKNdVLJIr/J4A4+x5BZ2qhgoh3Q2NAIdkkKnLTGDtQVLqmWM2/gfBmu4iM
ivFw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=list-id:precedence:sender:content-transfer-encoding:mime-version
:references:in-reply-to:message-id:date:subject:cc:to:from
:dkim-signature;
bh=JbXX371XcyRiCxPSWRSuCHmP9QFGA3Pa8K2HEyMazrQ=;
b=rnCwbwcz6Y5ufbyUR5klatYI7PRKpyv8/5wfDs6dqEcEBMwVH3fFfee5vZMYmfQHcJ
JoYrAFZ4vZJqmrKJ+3lIw8SpR2QDHCsaSQv49heRSsZ8TbSQqRvF+Utug1BVKE8wvMHT
dPrOgyiDbed07YLwgE6RFlJjN52W/XeiRNv1qGrAq+ALWS8WwFIy4/Y7+Y1ZVfaEID5g
R2QR8pe6ROgDLfN1XNFU6XTgEVF+yX9Xf1HPDsNhSQEB3jd9OJNtHhGdwEoC8r/xzzx5
LxRaKzr24/e12b5lklCy6q4vobhLZjavOvezHhSOZzQYBX2+NKZRTSmGIOf7JQe1kdB7
4BDQ==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@joelfernandes.org header.s=google header.b="n6HKD/Eb";
spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org
Return-Path:
- -
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. +which would defeat the whole purpose of CONFIG_NO_HZ_IDLE. 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:
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. -
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.
1 int cpu; - 2 struct rcu_state *rsp; - 3 struct rcu_node *mynode; - 4 struct rcu_dynticks *dynticks; - 5 unsigned long grpmask; - 6 bool beenonline; + 2 struct rcu_node *mynode; + 3 unsigned long grpmask; + 4 bool beenonline;
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. - -
The ->grpmask field indicates the bit in +These two fields are constant and therefore donot require synchronization. +
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 +1151,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 +1208,11 @@ 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.