linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Marco Elver <elver@google.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	rcu <rcu@vger.kernel.org>, Steven Rostedt <rostedt@goodmis.org>,
	"Uladzislau Rezki (Sony)" <urezki@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Neeraj upadhyay <neeraj.iitr10@gmail.com>
Subject: Re: [PATCH v7 2/6] rcu/segcblist: Add counters to segcblist datastructure
Date: Wed, 21 Oct 2020 15:31:16 -0700	[thread overview]
Message-ID: <CAEXW_YRhU7SPqmh26AtDWxr48-1t2RDQ=MEax+F2+mqbyxH1yw@mail.gmail.com> (raw)
In-Reply-To: <20201021215304.GB78735@lothringen>

On Wed, Oct 21, 2020 at 2:53 PM Frederic Weisbecker <frederic@kernel.org> wrote:
>
> On Wed, Oct 21, 2020 at 11:33:14AM -0400, joel@joelfernandes.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@joelfernandes.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

  reply	other threads:[~2020-10-21 22:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15  0:22 [PATCH v7 0/6] Add support for length of each segment in the segcblist Joel Fernandes (Google)
2020-10-15  0:22 ` [PATCH v7 1/6] rcu/tree: Make rcu_do_batch count how many callbacks were executed Joel Fernandes (Google)
2020-10-15  0:22 ` [PATCH v7 2/6] rcu/segcblist: Add counters to segcblist datastructure Joel Fernandes (Google)
2020-10-15 12:21   ` Frederic Weisbecker
2020-10-17  1:31     ` joel
2020-10-21 15:33     ` joel
2020-10-21 21:53       ` Frederic Weisbecker
2020-10-21 22:31         ` Joel Fernandes [this message]
2020-10-18  8:23   ` [rcu/segcblist] e08055898f: WARNING:at_kernel/rcu/srcutree.c:#cleanup_srcu_struct kernel test robot
2020-10-21 14:40     ` joel
2020-10-15  0:22 ` [PATCH v7 3/6] rcu/trace: Add tracing for how segcb list changes Joel Fernandes (Google)
2020-10-15  0:22 ` [PATCH v7 4/6] rcu/segcblist: Remove useless rcupdate.h include Joel Fernandes (Google)
2020-10-15  0:23 ` [PATCH v7 5/6] rcu/tree: Remove redundant smp_mb() in rcu_do_batch Joel Fernandes (Google)
2020-10-15  0:23 ` [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb() Joel Fernandes (Google)
2020-10-15 13:35   ` Frederic Weisbecker
2020-10-17  1:27     ` joel
2020-10-17  3:19       ` joel
2020-10-17 13:29         ` Frederic Weisbecker
2020-10-18  0:35           ` joel
2020-10-19 12:37             ` Frederic Weisbecker
2020-10-21 18:57               ` Joel Fernandes
2020-10-21 21:16                 ` Frederic Weisbecker
2020-10-17 20:24         ` Alan Stern
2020-10-18 20:45           ` Joel Fernandes
2020-10-18 21:15             ` Alan Stern
2020-10-17 14:31       ` Alan Stern
2020-10-18 20:16         ` Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEXW_YRhU7SPqmh26AtDWxr48-1t2RDQ=MEax+F2+mqbyxH1yw@mail.gmail.com' \
    --to=joel@joelfernandes.org \
    --cc=elver@google.com \
    --cc=frederic@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=neeraj.iitr10@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=urezki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).