From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
Jonathan Corbet <corbet@lwn.net>,
Josh Triplett <josh@joshtriplett.org>,
Lai Jiangshan <jiangshanlai@gmail.com>,
linux-doc@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
"Paul E. McKenney" <paulmck@linux.ibm.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: [4/5] doc: rcu: Clarify better the rcu_segcblist len field
Date: Tue, 25 Sep 2018 11:26:00 -0700 [thread overview]
Message-ID: <20180925182601.37421-5-joel@joelfernandes.org> (raw)
In-Reply-To: <20180925182601.37421-1-joel@joelfernandes.org>
An important note under the rcu_segcblist description could use a
more detailed description. Especially explanation of the scenario
where the ->head field may be temporarily NULL making it not wise to
rely on it to determine if callbacks are associated with the
rcu_segcblist. Thanks Paul for clarifying over email.
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
.../RCU/Design/Data-Structures/Data-Structures.html | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/Documentation/RCU/Design/Data-Structures/Data-Structures.html b/Documentation/RCU/Design/Data-Structures/Data-Structures.html
index 3f9a8ae4287e..a45fc326d990 100644
--- a/Documentation/RCU/Design/Data-Structures/Data-Structures.html
+++ b/Documentation/RCU/Design/Data-Structures/Data-Structures.html
@@ -928,10 +928,16 @@ this <tt>rcu_segcblist</tt> structure, <i>not</i> the <tt>->head</tt>
pointer.
The reason for this is that all the ready-to-invoke callbacks
(that is, those in the <tt>RCU_DONE_TAIL</tt> segment) are extracted
-all at once at callback-invocation time.
+all at once at callback-invocation time (<tt>rcu_do_batch</tt>), due
+to which <tt>->head</tt> may be set to NULL if there are no more
+callbacks on the <tt>rcu_segcblist</tt>.
If callback invocation must be postponed, for example, because a
high-priority process just woke up on this CPU, then the remaining
-callbacks are placed back on the <tt>RCU_DONE_TAIL</tt> segment.
+callbacks are placed back on the <tt>RCU_DONE_TAIL</tt> segment and
+<tt>->head</tt> would point to the start of the segment. So as you
+can see, the head field is briefly NULL even though not all callbacks
+could be invoked, so we can't rely on it to tell us if there are no
+callbacks associated with the <tt>rcu_segcb_list</tt>.
Either way, the <tt>->len</tt> and <tt>->len_lazy</tt> counts
are adjusted after the corresponding callbacks have been invoked, and so
again it is the <tt>->len</tt> count that accurately reflects whether
--
2.19.0.444.g18242da7ef-goog
next prev parent reply other threads:[~2018-09-25 18:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 18:25 [0/5] rcu doc updates Joel Fernandes (Google)
2018-09-25 18:25 ` [1/5] doc: rcu: Update information about resched_cpu Joel Fernandes (Google)
2018-09-25 18:25 ` [2/5] doc: rcu: Remove rcu_dynticks from Data-Structures Joel Fernandes (Google)
2018-09-25 18:25 ` [3/5] doc: rcu: Update Data-Structures for RCU flavor consolidation Joel Fernandes (Google)
2018-09-25 18:26 ` Joel Fernandes (Google) [this message]
2018-09-25 18:26 ` [5/5] doc: rcu: Update description of gp_seq fields in rcu_data Joel Fernandes (Google)
2018-09-25 18:48 ` [0/5] rcu doc updates Joel Fernandes
2018-09-25 18:49 ` Joel Fernandes
2018-09-26 23:47 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180925182601.37421-5-joel@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=corbet@lwn.net \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.ibm.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).