[RFC PATCH 00/10] RCU: Enable callbacks to benefit from expedited grace periods

Puranjay Mohan posted 10 patches 1 month, 3 weeks ago
include/linux/rcu_segcblist.h |  16 ++--
include/trace/events/rcu.h    |   5 +-
kernel/rcu/rcu.h              |  13 ++-
kernel/rcu/rcu_segcblist.c    | 145 ++++++++++++++++++++++++----------
kernel/rcu/rcu_segcblist.h    |   8 +-
kernel/rcu/rcuscale.c         |  84 +++++++++++++++++++-
kernel/rcu/srcutree.c         |  14 ++--
kernel/rcu/tasks.h            |   8 +-
kernel/rcu/tree.c             |  54 +++++++++----
kernel/rcu/tree.h             |   1 +
kernel/rcu/tree_exp.h         |   1 +
kernel/rcu/tree_nocb.h        |  77 ++++++++++++++----
12 files changed, 324 insertions(+), 102 deletions(-)
[RFC PATCH 00/10] RCU: Enable callbacks to benefit from expedited grace periods
Posted by Puranjay Mohan 1 month, 3 weeks ago
RCU callbacks only track normal grace period sequence numbers. This
means callbacks must wait for normal GPs even when expedited GPs have
already elapsed.

This series tracks both normal and expedited GP sequences in the
callback infrastructure using struct rcu_gp_oldstate, so callbacks
advance when either GP type completes.

Commits 1-4 prepare the callback infrastructure: SRCU and Tasks RCU are
isolated behind wrapper functions, the segment compaction logic is
factored out for reuse, gp_seq is widened to struct rcu_gp_oldstate, and
RCU_GET_STATE_NOT_TRACKED is added for subsystems that do not track
expedited GPs.

Commit 5 is the core change: rcu_segcblist_advance() checks both normal
and expedited GP completion via poll_state_synchronize_rcu_full(), and
rcu_accelerate_cbs() captures both GP sequences via
get_state_synchronize_rcu_full(). SRCU wrappers become standalone
implementations since they cannot use poll_state_synchronize_rcu_full()
which reads RCU-specific globals.

Commits 7-9 fix three notification paths so that expedited GP completion
triggers callback processing: NOCB rcuog kthreads are woken,
rcu_pending() detects the completion, and rcu_core() advances the
callbacks.

Commit 10 adds nexp and exp_interval parameters to rcuscale for testing
callback drain under concurrent expedited GP load.

Puranjay Mohan (10):
  rcu/segcblist: Add SRCU and Tasks RCU wrapper functions
  rcu/segcblist: Factor out rcu_segcblist_advance_compact() helper
  rcu/segcblist: Change gp_seq to struct rcu_gp_oldstate gp_seq_full
  rcu: Add RCU_GET_STATE_NOT_TRACKED for subsystems without expedited
    GPs
  rcu: Enable RCU callbacks to benefit from expedited grace periods
  rcu: Update comments for gp_seq_full and expedited GP tracking
  rcu: Wake NOCB rcuog kthreads on expedited grace period completion
  rcu: Detect expedited grace period completion in rcu_pending()
  rcu: Advance callbacks for expedited GP completion in rcu_core()
  rcuscale: Add concurrent expedited GP threads for callback scaling
    tests

 include/linux/rcu_segcblist.h |  16 ++--
 include/trace/events/rcu.h    |   5 +-
 kernel/rcu/rcu.h              |  13 ++-
 kernel/rcu/rcu_segcblist.c    | 145 ++++++++++++++++++++++++----------
 kernel/rcu/rcu_segcblist.h    |   8 +-
 kernel/rcu/rcuscale.c         |  84 +++++++++++++++++++-
 kernel/rcu/srcutree.c         |  14 ++--
 kernel/rcu/tasks.h            |   8 +-
 kernel/rcu/tree.c             |  54 +++++++++----
 kernel/rcu/tree.h             |   1 +
 kernel/rcu/tree_exp.h         |   1 +
 kernel/rcu/tree_nocb.h        |  77 ++++++++++++++----
 12 files changed, 324 insertions(+), 102 deletions(-)


base-commit: 51289896149317e0b6a4abf5d300a569c3353dca
-- 
2.52.0
Re: [RFC PATCH 00/10] RCU: Enable callbacks to benefit from expedited grace periods
Posted by Frederic Weisbecker 2 weeks, 1 day ago
Hi,

Le Fri, Apr 17, 2026 at 04:11:48PM -0700, Puranjay Mohan a écrit :
> RCU callbacks only track normal grace period sequence numbers. This
> means callbacks must wait for normal GPs even when expedited GPs have
> already elapsed.
> 
> This series tracks both normal and expedited GP sequences in the
> callback infrastructure using struct rcu_gp_oldstate, so callbacks
> advance when either GP type completes.

What is the motivation behind this? When most callbacks don't have much latency
requirements between queue and invocation?

Thanks.

-- 
Frederic Weisbecker
SUSE Labs
Re: [RFC PATCH 00/10] RCU: Enable callbacks to benefit from expedited grace periods
Posted by Puranjay Mohan 1 week, 2 days ago
Hi Frederic,

Thanks a lot for the detailed feedback on all patches, I will send the
next version soon with requested changes.


On Thu, May 28, 2026 at 1:14 PM Frederic Weisbecker <frederic@kernel.org> wrote:
>
> Hi,
>
> Le Fri, Apr 17, 2026 at 04:11:48PM -0700, Puranjay Mohan a écrit :
> > RCU callbacks only track normal grace period sequence numbers. This
> > means callbacks must wait for normal GPs even when expedited GPs have
> > already elapsed.
> >
> > This series tracks both normal and expedited GP sequences in the
> > callback infrastructure using struct rcu_gp_oldstate, so callbacks
> > advance when either GP type completes.
>
> What is the motivation behind this? When most callbacks don't have much latency
> requirements between queue and invocation?

Right now there's an asymmetry: synchronize_rcu_expedited() callers
get fast object freeing, but call_rcu() callers never benefit from
those same grace periods even though they prove the exact same thing.
This series closes that gap, the callback infrastructure treats a
grace period as a grace period regardless of how it was driven. The
practical effect is faster memory reclaim: objects that could already
be safely freed stop sitting around waiting for the next normal GP.
I'll make this motivation clearer in the next version.

Thanks,
Puranjay