Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1522428

Re: [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods recheck dyntick idle state

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods recheck dyntick idle state
Date 2016-11-15 09:20 +0100
Message-ID <sDH8d-2s4-7@gated-at.bofh.it> (permalink)
References <sDsLU-16h-9@gated-at.bofh.it> <sDsLV-16h-51@gated-at.bofh.it> <sDteW-1wp-29@gated-at.bofh.it> <sDtoC-1A0-27@gated-at.bofh.it> <sDu1k-25s-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Nov 14, 2016 at 10:12:37AM -0800, Paul E. McKenney wrote:
> 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.

OK, so something similar to:

	smp_mb();
	atomic_read();

then? That would order, with global transitivity, against prior
operations.

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

My concern is mostly that it reads very weird. I appreciate this not
being fast path code, but confusing code is bad in any form.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH tip/core/rcu 0/7] Miscellaneous fixes for 4.10 "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 18:00 +0100
  [PATCH tip/core/rcu 3/7] rcu: Remove obsolete comment from __call_rcu() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 18:00 +0100
  [PATCH tip/core/rcu 2/7] rcu: Remove obsolete rcu_check_callbacks() header comment "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 18:00 +0100
  [PATCH tip/core/rcu 4/7] rcu: RCU_TRACE enables event tracing as well as debugfs "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 18:00 +0100
  [PATCH tip/core/rcu 7/7] rcu: Don't kick unless grace period or request "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 18:00 +0100
  [PATCH tip/core/rcu 1/7] rcu: Tighten up __call_rcu() rcu_head alignment check "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 18:00 +0100
  [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods recheck dyntick idle state "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 18:00 +0100
    Re: [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods  recheck dyntick idle state Josh Triplett <josh@joshtriplett.org> - 2016-11-14 18:30 +0100
      Re: [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods  recheck dyntick idle state Peter Zijlstra <peterz@infradead.org> - 2016-11-14 18:40 +0100
        Re: [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods  recheck dyntick idle state "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 19:20 +0100
          Re: [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods  recheck dyntick idle state Peter Zijlstra <peterz@infradead.org> - 2016-11-15 09:20 +0100
            Re: [PATCH tip/core/rcu 6/7] rcu: Make expedited grace periods  recheck dyntick idle state "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-15 15:40 +0100
  [PATCH tip/core/rcu 5/7] torture: Trace long read-side delays "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 18:00 +0100
    Re: [PATCH tip/core/rcu 5/7] torture: Trace long read-side delays Josh Triplett <josh@joshtriplett.org> - 2016-11-14 18:30 +0100
      Re: [PATCH tip/core/rcu 5/7] torture: Trace long read-side delays "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-14 19:50 +0100
        Re: [PATCH tip/core/rcu 5/7] torture: Trace long read-side delays Josh Triplett <josh@joshtriplett.org> - 2016-11-14 20:00 +0100
  Re: [PATCH tip/core/rcu 0/7] Miscellaneous fixes for 4.10 Josh Triplett <josh@joshtriplett.org> - 2016-11-14 18:30 +0100

csiph-web