On Tue, 8 Sep 2026 16:38:19 -0700 "Paul E. McKenney" <[email protected]> wrote:
> On Mon, Sep 07, 2026 at 03:58:23PM +0800, Kunwu Chan wrote: > > From: Kunwu Chan <[email protected]> > > > > The transition-to-big code path in srcu_gp_end() calls > > init_srcu_struct_nodes() with GFP_KERNEL, which is illegal in the > > atomic context reachable from synchronize_srcu_atomic(). Atomic SRCU > > has no use for the srcu_node combining tree: it has neither callbacks > > nor srcu_barrier() operations, and its grace periods are serialized > > by ->srcu_atomic_gp_flag instead. > > > > Skip this transition entirely for atomic SRCU, which is also defense > > in depth against any path that might wrongly set ->srcu_size_state for > > an atomic srcu_struct. > > > > Signed-off-by: Kunwu Chan <[email protected]> > > Again, given that we have this commit, is this patch needed? > > 4e01d5320a2f ("srcutree: Suppress to-big transition for atomic SRCU") > > And again, if so, please tell me what I am missing. Yes, this is a separate transition path. That commit suppresses the initialization-time transition, while this patch prevents the transition from srcu_gp_end(), which can otherwise call init_srcu_struct_nodes(..., GFP_KERNEL) for an atomic SRCU. So this is defense in depth for the atomic path. Thanks, KunWu > > Thanx, Paul > > > --- > > kernel/rcu/srcutree.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c > > index 01f224a56b41..74acd5645d4c 100644 > > --- a/kernel/rcu/srcutree.c > > +++ b/kernel/rcu/srcutree.c > > @@ -1074,8 +1074,9 @@ static void srcu_gp_end(struct srcu_struct *ssp, bool > > is_atomic) > > raw_spin_unlock_irq_rcu_node(sup); > > } > > > > - /* Transition to big if needed. */ > > - if (ss_state != SRCU_SIZE_SMALL && ss_state != SRCU_SIZE_BIG) { > > + /* Transition to big if needed, but never for atomic SRCU. */ > > + if (!is_atomic && ss_state != SRCU_SIZE_SMALL && > > + ss_state != SRCU_SIZE_BIG) { > > if (ss_state == SRCU_SIZE_ALLOC) > > init_srcu_struct_nodes(ssp, GFP_KERNEL); > > else > > -- > > 2.43.0 > > > Sent using hkml (https://github.com/sjp38/hackermail)

