From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751875Ab1KCEsL (ORCPT ); Thu, 3 Nov 2011 00:48:11 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:46324 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116Ab1KCEsG (ORCPT ); Thu, 3 Nov 2011 00:48:06 -0400 X-Originating-IP: 217.70.178.142 X-Originating-IP: 50.43.15.19 Date: Wed, 2 Nov 2011 21:47:44 -0700 From: Josh Triplett To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, patches@linaro.org, "Paul E. McKenney" Subject: Re: [PATCH RFC tip/core/rcu 27/28] rcu: Allow dyntick-idle mode for CPUs with callbacks Message-ID: <20111103044743.GG2042@leaf> References: <20111102203017.GA3830@linux.vnet.ibm.com> <1320265849-5744-27-git-send-email-paulmck@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1320265849-5744-27-git-send-email-paulmck@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 02, 2011 at 01:30:48PM -0700, Paul E. McKenney wrote: > /* > - * Check to see if any future RCU-related work will need to be done > - * by the current CPU, even if none need be done immediately, returning > - * 1 if so. This function is part of the RCU implementation; it is -not- > - * an exported member of the RCU API. > + * Allow the CPU to enter dyntick-idle mode if either: (1) There are no > + * callbacks on this CPU, (2) this CPU has not yet attempted to enter > + * dyntick-idle mode, and (3) this CPU is in the process of attempting to > + * enter dyntick-idle mode. Otherwise, if we have recently tried and failed This sentence doesn't quite work; "if either...and..." should become "either...or" or "if...and". > + * to enter dyntick-idle mode, we refuse to try to enter it. After all, > + * it is better to incur scheduling-clock interrupts than to spin > + * continuously for the same time duration! > + */ > +int rcu_needs_cpu(int cpu) > +{ > + /* If no callbacks, RCU doesn't need the CPU. */ > + if (!rcu_cpu_has_callbacks(cpu)) > + return 0; > + /* Otherwise, RCU needs the CPU only if it recently tried and failed. */ > + return per_cpu(rcu_dyntick_holdoff, cpu) == jiffies; Sigh, one more use of jiffies. :( - Josh Triplett