[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180925182601.37421-5-joel@joelfernandes.org>
Date: Tue, 25 Sep 2018 11:26:00 -0700
From: "Joel Fernandes (Google)" <joel@...lfernandes.org>
To: linux-kernel@...r.kernel.org
Cc: "Joel Fernandes (Google)" <joel@...lfernandes.org>,
Jonathan Corbet <corbet@....net>,
Josh Triplett <josh@...htriplett.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
linux-doc@...r.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
"Paul E. McKenney" <paulmck@...ux.ibm.com>,
Steven Rostedt <rostedt@...dmis.org>
Subject: [4/5] doc: rcu: Clarify better the rcu_segcblist len field
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@...lfernandes.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
Powered by blists - more mailing lists