On Fri, Sep 11, 2026 at 10:12:37AM +0800, KunWu Chan wrote:
> On Fri, Sep 11, 2026 at 12:53 AM Paul E. McKenney <[email protected]> wrote:
> >
> > On Thu, Sep 10, 2026 at 12:14:27PM +0800, Kunwu Chan wrote:
> > > Atomic SRCU does not use the srcu_node combining tree.  Exclude it
> > > from the SRCU_SIZING_IS_TORTURE() transition in
> > > srcu_torture_stats_print().
> > >
> > > Signed-off-by: Kunwu Chan <[email protected]>
> > > ---
> > >  kernel/rcu/srcutree.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> > > index d462102c6bb6..99d11fb4123a 100644
> > > --- a/kernel/rcu/srcutree.c
> > > +++ b/kernel/rcu/srcutree.c
> > > @@ -2421,7 +2421,7 @@ void srcu_torture_stats_print(struct srcu_struct 
> > > *ssp, char *tt, char *tf)
> > >               }
> > >               pr_cont(" T(%ld,%ld)\n", s0, s1);
> > >       }
> > > -     if (SRCU_SIZING_IS_TORTURE())
> > > +     if (SRCU_SIZING_IS_TORTURE() && ssp->srcu_reader_flavor != 
> > > SRCU_READ_FLAVOR_ATOMIC)
> > >               srcu_transition_to_big(ssp);
> > >  }
> >
> > Much better, thank you!
> >
> > Could you also please add an "else" clause with a WARN_ON_ONCE()
> > for ssp->srcu_reader_flavor == SRCU_READ_FLAVOR_ATOMIC?
> >
> > This is after all a user error where someone said to torture atomic SRCU
> > but also said to transition to big.
> 
> Thanks, Paul.
> Agreed. I'll add the warning in the next version:
> if (SRCU_SIZING_IS_TORTURE()) {
>         if (WARN_ON_ONCE(ssp->srcu_reader_flavor ==
>                          SRCU_READ_FLAVOR_ATOMIC))
>                 return;
>         srcu_transition_to_big(ssp);
> }
> 
> This keeps atomic SRCU out of the to-big transition while exposing
> the invalid torture configuration.

Again, sounds good!

                                                        Thanx, Paul

> Thanks,
> Kunwu
> 
> >
> >                                                         Thanx, Paul
> >
> > >  EXPORT_SYMBOL_GPL(srcu_torture_stats_print);
> > > --
> > > 2.43.0
> > >

Reply via email to