From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753852AbbGBPVv (ORCPT ); Thu, 2 Jul 2015 11:21:51 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:44135 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753090AbbGBPVb (ORCPT ); Thu, 2 Jul 2015 11:21:31 -0400 X-Helo: d03dlp02.boulder.ibm.com X-MailFrom: paulmck@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Date: Thu, 2 Jul 2015 07:06:17 -0700 From: "Paul E. McKenney" To: Peter Zijlstra 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 RFC tip/core/rcu 2/5] rcu: Short-circuit normal GPs via expedited GPs Message-ID: <20150702140617.GG3717@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20150630214805.GA7795@linux.vnet.ibm.com> <1435700910-9104-1-git-send-email-paulmck@linux.vnet.ibm.com> <1435700910-9104-2-git-send-email-paulmck@linux.vnet.ibm.com> <20150701100521.GP19282@twins.programming.kicks-ass.net> <20150701134143.GY3717@linux.vnet.ibm.com> <20150701134806.GF25159@twins.programming.kicks-ass.net> <20150701140313.GD3717@linux.vnet.ibm.com> <20150702120329.GO3644@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150702120329.GO3644@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15070215-0021-0000-0000-00000E19A56A Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 02, 2015 at 02:03:29PM +0200, Peter Zijlstra wrote: > On Wed, Jul 01, 2015 at 07:03:13AM -0700, Paul E. McKenney wrote: > > On Wed, Jul 01, 2015 at 03:48:06PM +0200, Peter Zijlstra wrote: > > > On Wed, Jul 01, 2015 at 06:41:44AM -0700, Paul E. McKenney wrote: > > > > On Wed, Jul 01, 2015 at 12:05:21PM +0200, Peter Zijlstra wrote: > > > > > On Tue, Jun 30, 2015 at 02:48:27PM -0700, Paul E. McKenney wrote: > > > > > > rsp->gp_state = RCU_GP_WAIT_FQS; > > > > > > ret = wait_event_interruptible_timeout(rsp->gp_wq, > > > > > > + ((gf = READ_ONCE(rsp->gp_flags)) & > > > > > > + RCU_GP_FLAG_FQS) || > > > > > > + (!READ_ONCE(rnp->qsmask) && > > > > > > + !rcu_preempt_blocked_readers_cgp(rnp)) || > > > > > > + rcu_exp_gp_seq_done(rsp->exp_rsp, > > > > > > + rsp->gp_exp_snap), > > > > > > + j); > > > > > > rsp->gp_state = RCU_GP_DONE_FQS; > > > > > > > > > > How can the GP be done if we timed out or got interrupted? > > > > > > > > If all the CPUs still blocking the grace period went idle, or in a > > > > NO_HZ_FULL kernel, entered nohz_full userspace execution. Or, if > > > > certain low-probability races happen, went offline. > > > > > > But what if none of those are true and we still timed out? You > > > unconditionally grant the GP. > > > > Say what??? > > > > I recheck the conditions and break out of the loop only if one or more > > of the grace-period-end conditions is satisfied. If not, I invoke > > rcu_gp_fqs() to do the scan to see if all remaining CPUs are idle, > > in nohz_full userspace execution, or offline. > > > > What am I mising here? > > The whole wait_event_interruptible_timeout() thing can end without @cond > being true, after which you unconditionally set ->gp_state = > RCU_GP_DONE_FQS. Ah, but then if the grace period is not done, even after a scan forcing quiescent states, we go back through the loop and set it back to RCU_GP_WAIT_FQS. Or is your point that RCU_GP_DONE_FQS is a bad name? Perhaps I should change it to something like RCU_GP_DOING_FQS. Or am I still missing something here? Thanx, Paul