linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Josh Triplett <josh@joshtriplett.org>,
	linux-kernel@vger.kernel.org, mingo@kernel.org,
	jiangshanlai@gmail.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	tglx@linutronix.de, rostedt@goodmis.org, dhowells@redhat.com,
	edumazet@google.com, dvhart@linux.intel.com, fweisbec@gmail.com,
	oleg@redhat.com, bobby.prani@gmail.com
Subject: Re: [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods recheck dyntick idle state
Date: Mon, 14 Nov 2016 10:12:37 -0800	[thread overview]
Message-ID: <20161114181237.GM4127@linux.vnet.ibm.com> (raw)
In-Reply-To: <20161114173733.GJ3142@twins.programming.kicks-ass.net>

On Mon, Nov 14, 2016 at 06:37:33PM +0100, Peter Zijlstra wrote:
> On Mon, Nov 14, 2016 at 09:25:12AM -0800, Josh Triplett wrote:
> > On Mon, Nov 14, 2016 at 08:57:12AM -0800, Paul E. McKenney wrote:
> > > Expedited grace periods check dyntick-idle state, and avoid sending
> > > IPIs to idle CPUs, including those running guest OSes, and, on NOHZ_FULL
> > > kernels, nohz_full CPUs.  However, the kernel has been observed checking
> > > a CPU while it was non-idle, but sending the IPI after it has gone
> > > idle.  This commit therefore rechecks idle state immediately before
> > > sending the IPI, refraining from IPIing CPUs that have since gone idle.
> > > 
> > > Reported-by: Rik van Riel <riel@redhat.com>
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > 
> > atomic_add_return(0, ...) seems odd.  Do you actually want that, rather
> > than atomic_read(...)?  If so, can you please document exactly why?
> 
> Yes that is weird. The only effective difference is that it would do a
> load-exclusive instead of a regular load.

It is weird, and checking to see if it is safe to convert it and its
friends to something with less overhead is on my list.   This starts
with a patch series I will post soon that consolidates all these
atomic_add_return() calls into a single function, which will ease testing
and other verification.

All that aside, please keep in mind that much is required from this load.
It is part of a network of ordered operations that guarantee that any
operation from any CPU preceding a given grace period is seen to precede
any other operation from any CPU following that same grace period.
And each and every CPU must agree on the order of those two operations,
otherwise, RCU is broken.

In addition, please note also that these operations are nowhere near
any fastpaths.

In fact, the specific operation you are concerned about is in an expedited
grace period, which has significant overhead.  This this added IPI can
substitute for an IPI, so, believe it or not, is an optimization.

							Thanx, Paul

  reply	other threads:[~2016-11-14 18:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 16:56 [PATCH tip/core/rcu 0/7] Miscellaneous fixes for 4.10 Paul E. McKenney
2016-11-14 16:57 ` [PATCH tip/core/rcu 1/7] rcu: Tighten up __call_rcu() rcu_head alignment check Paul E. McKenney
2016-11-14 16:57 ` [PATCH tip/core/rcu 2/7] rcu: Remove obsolete rcu_check_callbacks() header comment Paul E. McKenney
2016-11-14 16:57 ` [PATCH tip/core/rcu 3/7] rcu: Remove obsolete comment from __call_rcu() Paul E. McKenney
2016-11-14 16:57 ` [PATCH tip/core/rcu 4/7] rcu: RCU_TRACE enables event tracing as well as debugfs Paul E. McKenney
2016-11-14 16:57 ` [PATCH tip/core/rcu 5/7] torture: Trace long read-side delays Paul E. McKenney
2016-11-14 17:21   ` Josh Triplett
2016-11-14 18:44     ` Paul E. McKenney
2016-11-14 18:54       ` Josh Triplett
2016-11-14 16:57 ` [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods recheck dyntick idle state Paul E. McKenney
2016-11-14 17:25   ` Josh Triplett
2016-11-14 17:37     ` Peter Zijlstra
2016-11-14 18:12       ` Paul E. McKenney [this message]
2016-11-15  8:16         ` Peter Zijlstra
2016-11-15 14:36           ` Paul E. McKenney
2016-11-14 16:57 ` [PATCH tip/core/rcu 7/7] rcu: Don't kick unless grace period or request Paul E. McKenney
2016-11-14 17:26 ` [PATCH tip/core/rcu 0/7] Miscellaneous fixes for 4.10 Josh Triplett

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=20161114181237.GM4127@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bobby.prani@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhart@linux.intel.com \
    --cc=edumazet@google.com \
    --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@kernel.org \
    --cc=oleg@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).