Re: [PATCH 3/4] rcu: Use better variable names in funnel locking loop

From: Paul E. McKenney
Date: Wed May 23 2018 - 14:40:29 EST


On Wed, May 23, 2018 at 09:06:17AM -0700, Paul E. McKenney wrote:
> On Tue, May 22, 2018 at 11:38:14PM -0700, Joel Fernandes wrote:
> > From: "Joel Fernandes (Google)" <joel@xxxxxxxxxxxxxxxxx>
> >
> > The funnel locking loop in rcu_start_this_gp uses rcu_root as a
> > temporary variable while walking the combining tree. This causes a
> > tiresome exercise of a code reader reminding themselves that rcu_root
> > may not be root. Lets just call it rnp, and rename other variables as
> > well to be more appropriate.
> >
> > Original patch: https://patchwork.kernel.org/patch/10396577/
> >
> > Signed-off-by: Joel Fernandes <joel@xxxxxxxxxxxxxxxxx>
> > Signed-off-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx>
>
> I used to have double Signed-off-by back when I was seconded to Linaro.
> But I am guessing that you want the second and don't need the first
> one. Unless you tell me otherwise, I will remove the first one on
> my next rebase.
>
> Anyway, the new variable names are much more clear, good stuff,
> queued for further review and testing, thank you!

And it looks to me like I should fold in the patchlet below to change to
rnp_start in a comment. Please let me know if this would mess things up.

Thanx, Paul

------------------------------------------------------------------------

commit 94ce05d9d110b8c34eca6641ca5221c1b150e99f
Author: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Date: Wed May 23 12:22:01 2018 -0700

fixup! rcu: Use better variable names in funnel locking loop

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 65e49282429c..fdba8ab95e2c 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1550,11 +1550,11 @@ static bool rcu_start_this_gp(struct rcu_node *rnp_start, struct rcu_data *rdp,
/*
* Use funnel locking to either acquire the root rcu_node
* structure's lock or bail out if the need for this grace period
- * has already been recorded -- or has already started. If there
- * is already a grace period in progress in a non-leaf node, no
- * recording is needed because the end of the grace period will
- * scan the leaf rcu_node structures. Note that rnp->lock must
- * not be released.
+ * has already been recorded -- or if that grace period has in
+ * fact already started. If there is already a grace period in
+ * progress in a non-leaf node, no recording is needed because the
+ * end of the grace period will scan the leaf rcu_node structures.
+ * Note that rnp_start->lock must not be released.
*/
raw_lockdep_assert_held_rcu_node(rnp_start);
trace_rcu_this_gp(rnp_start, rdp, gp_seq_req, TPS("Startleaf"));