From: Frederic Weisbecker <frederic@kernel.org>
To: Puranjay Mohan <puranjay@kernel.org>
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
"Paul E. McKenney" <paulmck@kernel.org>,
Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
Joel Fernandes <joelagnelf@nvidia.com>,
Josh Triplett <josh@joshtriplett.org>,
Boqun Feng <boqun@kernel.org>,
Uladzislau Rezki <urezki@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Zqiang <qiang.zhang@linux.dev>,
Masami Hiramatsu <mhiramat@kernel.org>,
Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: [RFC PATCH 03/10] rcu/segcblist: Change gp_seq to struct rcu_gp_oldstate gp_seq_full
Date: Thu, 28 May 2026 15:15:27 +0200 [thread overview]
Message-ID: <ahg_7wEDrgMd_5fs@localhost.localdomain> (raw)
In-Reply-To: <20260417231203.785172-4-puranjay@kernel.org>
Le Fri, Apr 17, 2026 at 04:11:51PM -0700, Puranjay Mohan a écrit :
> This commit renames the ->gp_seq[] field in struct rcu_segcblist to
> ->gp_seq_full[] and changes its type from unsigned long to struct
> rcu_gp_oldstate. This prepares the callback tracking infrastructure to
> support both normal and expedited grace periods.
>
> All function signatures are updated to pass struct rcu_gp_oldstate
> pointers: rcu_segcblist_nextgp(), rcu_segcblist_advance(), and
> rcu_segcblist_accelerate() now take struct rcu_gp_oldstate * instead of
> unsigned long. All callers are updated to use the .rgos_norm field for
> comparisons and assignments.
>
> The SRCU and Tasks RCU wrappers now construct an rcu_gp_oldstate with
> just .rgos_norm set and forward to the core functions.
>
> No functional change: only the .rgos_norm field is used in place of
> gp_seq.
>
> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> ---
> include/linux/rcu_segcblist.h | 2 +-
> include/trace/events/rcu.h | 5 +++--
> kernel/rcu/rcu_segcblist.c | 30 +++++++++++++++++-------------
> kernel/rcu/rcu_segcblist.h | 6 +++---
> kernel/rcu/tree.c | 25 ++++++++++++++-----------
> kernel/rcu/tree_nocb.h | 29 +++++++++++++++--------------
> 6 files changed, 53 insertions(+), 44 deletions(-)
>
> diff --git a/include/linux/rcu_segcblist.h b/include/linux/rcu_segcblist.h
> index 2fdc2208f1ca..59c68f2ba113 100644
> --- a/include/linux/rcu_segcblist.h
> +++ b/include/linux/rcu_segcblist.h
> @@ -190,7 +190,7 @@ struct rcu_cblist {
> struct rcu_segcblist {
> struct rcu_head *head;
> struct rcu_head **tails[RCU_CBLIST_NSEGS];
> - unsigned long gp_seq[RCU_CBLIST_NSEGS];
> + struct rcu_gp_oldstate gp_seq_full[RCU_CBLIST_NSEGS];
That could stay as gp_seq.
> #ifdef CONFIG_RCU_NOCB_CPU
> atomic_long_t len;
> #else
> diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c
> index 421f1dadb5e5..00e164db8b74 100644
> --- a/kernel/rcu/rcu_segcblist.c
> +++ b/kernel/rcu/rcu_segcblist.c
> @@ -496,7 +496,7 @@ static void rcu_segcblist_advance_compact(struct rcu_segcblist *rsclp, int i)
> * Advance the callbacks in the specified rcu_segcblist structure based
> * on the current value passed in for the grace-period counter.
> */
> -void rcu_segcblist_advance(struct rcu_segcblist *rsclp, unsigned long seq)
> +void rcu_segcblist_advance(struct rcu_segcblist *rsclp, struct
> rcu_gp_oldstate *rgosp)
I don't think we need to rename everything to rgos*, especially as it's not as
intuitive as gp_seq.
> {
> int i;
>
> @@ -1229,7 +1231,8 @@ static bool rcu_advance_cbs(struct rcu_node *rnp, struct rcu_data *rdp)
> * Find all callbacks whose ->gp_seq numbers indicate that they
> * are ready to invoke, and put them into the RCU_DONE_TAIL sublist.
> */
> - rcu_segcblist_advance(&rdp->cblist, rnp->gp_seq);
> + rgos.rgos_norm = rnp->gp_seq;
Can we shorten that rgos_norm field to just norm?
So the above would parse better as:
gp_seq->norm = rnp->gp_seq
> + rcu_segcblist_advance(&rdp->cblist, &rgos);
>
> /* Classify any remaining callbacks. */
> return rcu_accelerate_cbs(rnp, rdp);
> diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
> index 1047b30cd46b..1837eedfb8c2 100644
> --- a/kernel/rcu/tree_nocb.h
> +++ b/kernel/rcu/tree_nocb.h
> @@ -433,7 +433,7 @@ static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
> bool lazy)
> {
> unsigned long c;
> - unsigned long cur_gp_seq;
> + struct rcu_gp_oldstate cur_gp_seq_full;
This could stay as cur_gp_seq.
> unsigned long j = jiffies;
> long ncbs = rcu_cblist_n_cbs(&rdp->nocb_bypass);
> long lazy_len = READ_ONCE(rdp->lazy_len);
> @@ -501,8 +501,8 @@ static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
> return false; // Caller must enqueue the callback.
> }
> if (j != rdp->nocb_gp_adv_time &&
> - rcu_segcblist_nextgp(&rdp->cblist, &cur_gp_seq) &&
> - rcu_seq_done(&rdp->mynode->gp_seq, cur_gp_seq)) {
> + rcu_segcblist_nextgp(&rdp->cblist, &cur_gp_seq_full) &&
> + rcu_seq_done(&rdp->mynode->gp_seq, cur_gp_seq_full.rgos_norm)) {
Because cur_gp_seq.norm would parse much better.
> rcu_advance_cbs_nowake(rdp->mynode, rdp);
> rdp->nocb_gp_adv_time = j;
> }
> @@ -659,7 +659,7 @@ static void nocb_gp_wait(struct rcu_data *my_rdp)
> {
> bool bypass = false;
> int __maybe_unused cpu = my_rdp->cpu;
> - unsigned long cur_gp_seq;
> + struct rcu_gp_oldstate cur_gp_seq_full;
Ditto
> unsigned long flags;
> bool gotcbs = false;
> unsigned long j = jiffies;
> @@ -730,8 +730,8 @@ static void nocb_gp_wait(struct rcu_data *my_rdp)
> needwake_gp = false;
> if (!rcu_segcblist_restempty(&rdp->cblist,
> RCU_NEXT_READY_TAIL) ||
> - (rcu_segcblist_nextgp(&rdp->cblist, &cur_gp_seq) &&
> - rcu_seq_done(&rnp->gp_seq, cur_gp_seq))) {
> + (rcu_segcblist_nextgp(&rdp->cblist, &cur_gp_seq_full) &&
> + rcu_seq_done(&rnp->gp_seq, cur_gp_seq_full.rgos_norm))) {
> raw_spin_lock_rcu_node(rnp); /* irqs disabled. */
> needwake_gp = rcu_advance_cbs(rnp, rdp);
> wasempty = rcu_segcblist_restempty(&rdp->cblist,
> @@ -877,7 +877,7 @@ static inline bool nocb_cb_wait_cond(struct rcu_data *rdp)
> static void nocb_cb_wait(struct rcu_data *rdp)
> {
> struct rcu_segcblist *cblist = &rdp->cblist;
> - unsigned long cur_gp_seq;
> + struct rcu_gp_oldstate cur_gp_seq_full;
Ditto.
> unsigned long flags;
> bool needwake_gp = false;
> struct rcu_node *rnp = rdp->mynode;
Thanks.
--
Frederic Weisbecker
SUSE Labs
next prev parent reply other threads:[~2026-05-28 13:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 23:11 [RFC PATCH 00/10] RCU: Enable callbacks to benefit from expedited grace periods Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 01/10] rcu/segcblist: Add SRCU and Tasks RCU wrapper functions Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 02/10] rcu/segcblist: Factor out rcu_segcblist_advance_compact() helper Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 03/10] rcu/segcblist: Change gp_seq to struct rcu_gp_oldstate gp_seq_full Puranjay Mohan
2026-05-28 12:50 ` Frederic Weisbecker
2026-05-28 13:15 ` Frederic Weisbecker [this message]
2026-04-17 23:11 ` [RFC PATCH 04/10] rcu: Add RCU_GET_STATE_NOT_TRACKED for subsystems without expedited GPs Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 05/10] rcu: Enable RCU callbacks to benefit from expedited grace periods Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 06/10] rcu: Update comments for gp_seq_full and expedited GP tracking Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 07/10] rcu: Wake NOCB rcuog kthreads on expedited grace period completion Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 08/10] rcu: Detect expedited grace period completion in rcu_pending() Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 09/10] rcu: Advance callbacks for expedited GP completion in rcu_core() Puranjay Mohan
2026-04-17 23:11 ` [RFC PATCH 10/10] rcuscale: Add concurrent expedited GP threads for callback scaling tests Puranjay Mohan
2026-05-28 12:14 ` [RFC PATCH 00/10] RCU: Enable callbacks to benefit from expedited grace periods Frederic Weisbecker
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=ahg_7wEDrgMd_5fs@localhost.localdomain \
--to=frederic@kernel.org \
--cc=boqun@kernel.org \
--cc=dave@stgolabs.net \
--cc=jiangshanlai@gmail.com \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=puranjay@kernel.org \
--cc=qiang.zhang@linux.dev \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=urezki@gmail.com \
/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