Sorry to reply late. I was interrupted by something else. On Fri, Dec 02, 2022 at 02:17:13PM -0800, Paul E. McKenney wrote: > On Wed, Nov 30, 2022 at 11:34:59AM +0800, Pingfan Liu wrote: > > From: Pingfan Liu <kernelfans@xxxxxxxxx> > > > > The state SRCU_SIZE_WAIT_CALL is only used in srcu_gp_start_if_needed(). > > And it is not needed. Because counter_wrap_check has guarantee that both > > srcu_gp_seq_needed and srcu_gp_seq_needed_exp are not far behind > > srcu_gp_seq and no false alarm will be raised by the statement in > > srcu_gp_start_if_needed() > > > > ULONG_CMP_LT(sdp->srcu_gp_seq_needed, s) > > > > As a result, once if SRCU_SIZE_WAIT_BARRIER is seen, the tree snp can be > > used immediately, not need to wait for another srcu_gp_end() to update > > the srcu_gp_seq_needed and srcu_gp_seq_needed_exp to avoid false alarm. > > During the SRCU_SIZE_WAIT_BARRIER state, all callbacks are queued onto > the boot CPU's callback list, but the srcu_barrier() function scans all > of the CPUs' callback lists. > So at present, your concern is around how it affects srcu_barrier(), right? > So can't this cause srcu_gp_start_if_needed() to rcu_segcblist_advance() > and rcu_segcblist_accelerate() a callback list that is guaranteed to be > empty? Without this change, the might-not-be-empty boot CPU's callback > list is dealt with. > Is it a problem that srcu_gp_start_if_needed() asks rcu_segcblist_advance() and rcu_segcblist_accelerate() to manipulate an not-be-empty callback list ? At SRCU_SIZE_WAIT_BARRIER state, srcu_barrier() will take care of all cpus' callback list. > What am I missing here? More specifically, what benefits does this > change provide? I am not yet seeing any. > I am trying to improve the note around SRCU_SIZE_xx, and this is a trivial improve from 8 SRCU_SIZE state to 5. Thanks, Pingfan > Thanx, Paul > > > Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx> > > Cc: Lai Jiangshan <jiangshanlai@xxxxxxxxx> > > Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxx> > > Cc: Frederic Weisbecker <frederic@xxxxxxxxxx> > > Cc: Josh Triplett <josh@xxxxxxxxxxxxxxxx> > > Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> > > Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> > > Cc: "Zhang, Qiang1" <qiang1.zhang@xxxxxxxxx> > > To: rcu@xxxxxxxxxxxxxxx > > --- > > v1 -> v2: > > rebase onto dev branch > > 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 b25f77df9e5e..b0278d1e9c1f 100644 > > --- a/kernel/rcu/srcutree.c > > +++ b/kernel/rcu/srcutree.c > > @@ -1165,7 +1165,7 @@ static unsigned long srcu_gp_start_if_needed(struct srcu_struct *ssp, > > */ > > idx = __srcu_read_lock_nmisafe(ssp); > > ss_state = smp_load_acquire(&ssp->srcu_size_state); > > - if (ss_state < SRCU_SIZE_WAIT_CALL) > > + if (ss_state < SRCU_SIZE_WAIT_BARRIER) > > sdp = per_cpu_ptr(ssp->sda, get_boot_cpu_id()); > > else > > sdp = raw_cpu_ptr(ssp->sda); > > -- > > 2.31.1 > >