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: linux-kernel@vger.kernel.org, mingo@kernel.org,
	laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, 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 11/15] rcu: Break more call_rcu() deadlock involving scheduler and perf
Date: Mon, 1 Sep 2014 09:20:49 -0700	[thread overview]
Message-ID: <20140901162049.GM5001@linux.vnet.ibm.com> (raw)
In-Reply-To: <20140901112934.GH27892@worktop.ger.corp.intel.com>

On Mon, Sep 01, 2014 at 01:29:34PM +0200, Peter Zijlstra wrote:
> On Thu, Aug 28, 2014 at 11:26:30AM -0700, Paul E. McKenney wrote:
> 
> > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> > index b6acb9340192..a1af86099a67 100644
> > --- a/kernel/rcu/tree_plugin.h
> > +++ b/kernel/rcu/tree_plugin.h
> > @@ -2121,16 +2121,23 @@ static void __call_rcu_nocb_enqueue(struct rcu_data *rdp,
> >  			trace_rcu_nocb_wake(rdp->rsp->name, rdp->cpu,
> >  					    TPS("WakeEmpty"));
> >  		} else {
> > -			rdp->nocb_defer_wakeup = true;
> > +			rdp->nocb_defer_wakeup = RCU_NOGP_WAKE;
> >  			trace_rcu_nocb_wake(rdp->rsp->name, rdp->cpu,
> >  					    TPS("WakeEmptyIsDeferred"));
> >  		}
> >  		rdp->qlen_last_fqs_check = 0;
> >  	} else if (len > rdp->qlen_last_fqs_check + qhimark) {
> >  		/* ... or if many callbacks queued. */
> > -		wake_nocb_leader(rdp, true);
> > +		if (!irqs_disabled_flags(flags)) {
> > +			wake_nocb_leader(rdp, true);
> > +			trace_rcu_nocb_wake(rdp->rsp->name, rdp->cpu,
> > +					    TPS("WakeOvf"));
> > +		} else {
> > +			rdp->nocb_defer_wakeup = RCU_NOGP_WAKE_FORCE;
> > +			trace_rcu_nocb_wake(rdp->rsp->name, rdp->cpu,
> > +					    TPS("WakeOvfIsDeferred"));
> > +		}
> >  		rdp->qlen_last_fqs_check = LONG_MAX / 2;
> > -		trace_rcu_nocb_wake(rdp->rsp->name, rdp->cpu, TPS("WakeOvf"));
> >  	} else {
> >  		trace_rcu_nocb_wake(rdp->rsp->name, rdp->cpu, TPS("WakeNot"));
> >  	}
> 
> Is it possible for the RCU_NOCP_WAKE write to overwrite a WAKE_FORCE ?
> If not, why not? (Would make a good comment thereabouts).

Good point.

So RCU_NOGP_WAKE only happens on the empty-to-non-empty transition,
and that RCU_NOGP_WAKE_FORCE only happens once the queue has a large
number of entries (10,000 by default).  Because this code runs with irqs
disabled (and must because you can do call_rcu() from interrupt handlers),
RCU_NOGP_WAKE_FORCE could overwrite RCU_NOGP_WAKE, but not vice versa.

However, the same effect can be obtained by having the setting of
RCU_NOGP_WAKE_FORCE race with the call to do_nocb_deferred_wakeup().
However, this would require that the call to do_nocb_deferred_wakeup()
was delayed long enough for 9,999 additional callbacks be registered,
and the next 10,000 callbacks will do another RCU_NOGP_WAKE_FORCE.
In addition, the RCU_NOGP_WAKE_FORCE shortens delays in the rcuo kthreads
rather than waking a rcuo kthread that would otherwise sleep indefinitely.
So I didn't see the point of closing this window.

							Thanx, Paul


  reply	other threads:[~2014-09-01 16:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-28 18:26 [PATCH tip/core/rcu 0/15] Miscellaneous fixes for 3.18 Paul E. McKenney
2014-08-28 18:26 ` [PATCH tip/core/rcu 01/15] rcu: Remove remaining read-modify-write ACCESS_ONCE() calls Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 02/15] rcu: Fix sparse warning about rcu_batches_completed_preempt() being non-static Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 03/15] rcu: Use bool type for return value in rcu_is_watching() Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 04/15] rcu: Return bool type for rcu_try_advance_all_cbs() Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 05/15] rcu: Return bool type in rcu_lockdep_current_cpu_online() Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 06/15] rcu: Use true/false instead of 1/0 for a bool type Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 07/15] rcu: Uninline rcu_read_lock_held() Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 08/15] rcu: Define tracepoint strings only if CONFIG_TRACING is set Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 09/15] rcu: Update tiny.c references to tree.c Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 10/15] rcu: Remove stale comment in tree.c Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 11/15] rcu: Break more call_rcu() deadlock involving scheduler and perf Paul E. McKenney
2014-09-01 11:29     ` Peter Zijlstra
2014-09-01 16:20       ` Paul E. McKenney [this message]
2014-08-28 18:26   ` [PATCH tip/core/rcu 12/15] rcu: Make TINY_RCU tinier by putting error checks under #ifdef Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 13/15] rcu: Use rcu_gp_kthread_wake() to wake up grace period kthreads Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 14/15] rcu: Replace flush_signals() with WARN_ON(signal_pending()) Paul E. McKenney
2014-08-28 18:26   ` [PATCH tip/core/rcu 15/15] rcu: Add ACCESS_ONCE() for RCU_INIT_POINTER() Paul E. McKenney

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=20140901162049.GM5001@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=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --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