[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220609202312.GW1790663@paulmck-ThinkPad-P17-Gen-1>
Date: Thu, 9 Jun 2022 13:23:12 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Neeraj Upadhyay <quic_neeraju@...cinc.com>
Cc: frederic@...nel.org, josh@...htriplett.org, rostedt@...dmis.org,
mathieu.desnoyers@...icios.com, jiangshanlai@...il.com,
joel@...lfernandes.org, linux-kernel@...r.kernel.org,
boqun.feng@...il.com, urezki@...il.com
Subject: Re: [PATCH] rcu/tree: Add comment to describe GP done condition in
fqs loop
On Thu, Jun 09, 2022 at 12:43:40PM +0530, Neeraj Upadhyay wrote:
> Add a comment to explain why !rcu_preempt_blocked_readers_cgp() condition
> is required on root rnp node, for GP completion check in rcu_gp_fqs_loop().
>
> Signed-off-by: Neeraj Upadhyay <quic_neeraju@...cinc.com>
Thank you, Neeraj! As usual, I could not resist the urge to wordsmith
as shown below. Could you please check to see if I messed something up?
Thanx, Paul
------------------------------------------------------------------------
commit bdf3a744d3ad21336a390bfcc2e41de63f193eaf
Author: Neeraj Upadhyay <quic_neeraju@...cinc.com>
Date: Thu Jun 9 12:43:40 2022 +0530
rcu/tree: Add comment to describe GP-done condition in fqs loop
Add a comment to explain why !rcu_preempt_blocked_readers_cgp() condition
is required on root rnp node, for GP completion check in rcu_gp_fqs_loop().
Signed-off-by: Neeraj Upadhyay <quic_neeraju@...cinc.com>
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index a93c5f4d7e092..9a941e7ee6109 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2083,7 +2083,15 @@ static noinline_for_stack void rcu_gp_fqs_loop(void)
rcu_gp_torture_wait();
WRITE_ONCE(rcu_state.gp_state, RCU_GP_DOING_FQS);
/* Locking provides needed memory barriers. */
- /* If grace period done, leave loop. */
+ /*
+ * Exit the loop if the root rcu_node structure indicates that the grace period
+ * has ended, leave the loop. The rcu_preempt_blocked_readers_cgp(rnp) check
+ * is required only for single-node rcu_node trees because readers blocking
+ * the current grace period are queued only on leaf rcu_node structures.
+ * For multi-node trees, checking the root node's ->qsmask suffices, because a
+ * given root node's ->qsmask bit is cleared only when all CPUs and tasks from
+ * the corresponding leaf node have passed through their quiescent state.
+ */
if (!READ_ONCE(rnp->qsmask) &&
!rcu_preempt_blocked_readers_cgp(rnp))
break;
Powered by blists - more mailing lists