public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>,
	linux-kernel@vger.kernel.org, mingo@elte.hu, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
	josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
	rostedt@goodmis.org, Valdis.Kletnieks@vt.edu,
	dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com,
	fweisbec@gmail.com, patches@linaro.org
Subject: Re: [PATCH 3/4 V2] implement per-domain single-thread state machine call_srcu()
Date: Sat, 14 Apr 2012 08:26:04 -0700	[thread overview]
Message-ID: <20120414152604.GC2452@linux.vnet.ibm.com> (raw)
In-Reply-To: <1334409730.2528.103.camel@twins>

On Sat, Apr 14, 2012 at 03:22:10PM +0200, Peter Zijlstra wrote:
> On Tue, 2012-04-10 at 16:18 -0700, Paul E. McKenney wrote:
> > > +static void srcu_invoke_callbacks(struct srcu_struct *sp)
> > > +{
> > > +     int i;
> > > +     struct rcu_head *head;
> > > +
> > > +     for (i = 0; i < SRCU_CALLBACK_BATCH; i++) {
> > 
> > If there really can be thousands of callbacks dumped into SRCU, a more
> > adaptive strategy might be needed.  In the meantime, I am hoping that
> > the fact that the workqueue is retriggered in this case suffices.
> > 
> > Note that this function is preemptible, so there is less penalty for
> > running a very long batch.
> 
> With just the ->func() invocation below non-preemptible, I really don't
> see a point in having this loop limit.

Good point.

> > Which reminds me...  An srcu_struct structure with a large pile of
> > SRCU callbacks won't react very quickly in response to an invocation of
> > synchronize_srcu_expedited().  This is why the other RCU implementations
> > have a non-callback codepath for expedited grace periods.
> > 
> > Or am I missing something here?
> 
> I would suggest adding that extra complexity when we need it ;-)

If Lai Jiangshan is willing to commit to adding it when/if needed, I
am good with that.

> > > +             head = rcu_batch_dequeue(&sp->batch_done);
> > > +             if (!head)
> > > +                     break;
> > > +             head->func(head);
> > 
> > I have surrounded this with local_bh_disable() and local_bh_enable()
> > in order to enforce the no-sleeping-in-callbacks rule.  Please let me
> > know if I missed some other enforcement mechanism.
> 
> Is that -rt inspired hackery? Otherwise I would simply suggest
> preempt_disable/enable(), they do pretty much the same and are less
> confusing.

Nope.  It is hackery inspired by wanting to avoid gratuitous differences
between the SRCU-callback environment and the callback environments of
the other flavors of RCU callbacks.  People will move code from one
flavor of RCU to another, and we need to minimize the probability that
they will unwittingly introduce bugs when doing that.

							Thanx, Paul

> > > +     } 
> 


  reply	other threads:[~2012-04-14 15:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19  8:12 [PATCH 0/4 V2] rcu: implement call_srcu() Lai Jiangshan
2012-03-19  8:12 ` [PATCH 1/4 V2] rcu: fix srcu_readers_active() Lai Jiangshan
2012-03-19  8:12 ` [PATCH 2/4 V2] rcu: use "int trycount" instead of "bool expedited" Lai Jiangshan
2012-03-19  8:12 ` [PATCH 3/4 V2] implement per-domain single-thread state machine call_srcu() Lai Jiangshan
2012-04-10 23:18   ` Paul E. McKenney
2012-04-11 12:27     ` Paul E. McKenney
2012-04-14 13:22     ` Peter Zijlstra
2012-04-14 15:26       ` Paul E. McKenney [this message]
2012-03-19  8:12 ` [PATCH 4/4 V2] add srcu torture test Lai Jiangshan

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=20120414152604.GC2452@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=darren@dvhart.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=eric.dumazet@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=niv@us.ibm.com \
    --cc=patches@linaro.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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