[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEXW_YRhU7SPqmh26AtDWxr48-1t2RDQ=MEax+F2+mqbyxH1yw@mail.gmail.com>
Date: Wed, 21 Oct 2020 15:31:16 -0700
From: Joel Fernandes <joel@...lfernandes.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
Josh Triplett <josh@...htriplett.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
Marco Elver <elver@...gle.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
"Paul E. McKenney" <paulmck@...nel.org>, rcu <rcu@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
"Uladzislau Rezki (Sony)" <urezki@...il.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Neeraj upadhyay <neeraj.iitr10@...il.com>
Subject: Re: [PATCH v7 2/6] rcu/segcblist: Add counters to segcblist datastructure
On Wed, Oct 21, 2020 at 2:53 PM Frederic Weisbecker <frederic@...nel.org> wrote:
>
> On Wed, Oct 21, 2020 at 11:33:14AM -0400, joel@...lfernandes.org wrote:
> > On Thu, Oct 15, 2020 at 02:21:58PM +0200, Frederic Weisbecker wrote:
> > > On Wed, Oct 14, 2020 at 08:22:57PM -0400, Joel Fernandes (Google) wrote:
> > > > Add counting of segment lengths of segmented callback list.
> > > >
> > > > This will be useful for a number of things such as knowing how big the
> > > > ready-to-execute segment have gotten. The immediate benefit is ability
> > > > to trace how the callbacks in the segmented callback list change.
> > > >
> > > > Also this patch remove hacks related to using donecbs's ->len field as a
> > > > temporary variable to save the segmented callback list's length. This cannot be
> > > > done anymore and is not needed.
> > > >
> > > > Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
> > > > ---
> > > > include/linux/rcu_segcblist.h | 2 +
> > > > kernel/rcu/rcu_segcblist.c | 133 +++++++++++++++++++++++-----------
> > > > kernel/rcu/rcu_segcblist.h | 2 -
> > > > 3 files changed, 92 insertions(+), 45 deletions(-)
> > > >
> > > > diff --git a/include/linux/rcu_segcblist.h b/include/linux/rcu_segcblist.h
> > > > index b36afe7b22c9..d462ae5e340a 100644
> > > > --- a/include/linux/rcu_segcblist.h
> > > > +++ b/include/linux/rcu_segcblist.h
> > > > @@ -69,8 +69,10 @@ struct rcu_segcblist {
> > > > unsigned long gp_seq[RCU_CBLIST_NSEGS];
> > > > #ifdef CONFIG_RCU_NOCB_CPU
> > > > atomic_long_t len;
> > > > + atomic_long_t seglen[RCU_CBLIST_NSEGS];
> > >
> > > Also does it really need to be atomic?
> >
> > Yes, it need not be. I will make the change for ->seglen.
> >
> > BTW, for the existing ->len field, doesn't the following need to acquire nocb
> > lock?
> > rcu_nocb_try_bypass -> rcu_segcblist_inc_len
> >
> > It seems that will do a lock-less non-atomic RMW on a nocb offloaded list,
> > otherwise.
>
> I believe it shouldn't be necessary. That's an atomic add and the kthreads
> manipulating it shouldn't have any trouble concurrently. None that I can
> imagine tonight at least...
Ah yeah, of course. I got confused! Thanks.
> > Certainly rcu_nocb_do_flush_bypass() does do it so maybe it was missed?
>
> I believe it increments under the lock here because the inc happens to be on the way
> to the insertion of the callbacks :o)
Makes sense :)
thanks,
- Joel
Powered by blists - more mailing lists