Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936438AbdGTMvF (ORCPT ); Thu, 20 Jul 2017 08:51:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59950 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936208AbdGTMvC (ORCPT ); Thu, 20 Jul 2017 08:51:02 -0400 Date: Thu, 20 Jul 2017 05:50:54 -0700 From: "Paul E. McKenney" To: "Li, Aubrey" Cc: Thomas Gleixner , Andi Kleen , Peter Zijlstra , Frederic Weisbecker , Christoph Lameter , Aubrey Li , len.brown@intel.com, rjw@rjwysocki.net, tim.c.chen@linux.intel.com, arjan@linux.intel.com, yang.zhang.wz@gmail.com, x86@kernel.org, linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org Subject: Re: [RFC PATCH v1 00/11] Create fast idle path for short idle periods Reply-To: paulmck@linux.vnet.ibm.com References: <20170714162619.GJ3441@tassilo.jf.intel.com> <20170717192309.ubn5muvc3u7htuaw@hirez.programming.kicks-ass.net> <34371ef8-b8bc-d2bf-93de-3fccd6beb032@linux.intel.com> <20170718044521.GO3441@tassilo.jf.intel.com> <20170718152014.GB3981@linux.vnet.ibm.com> <20170719144827.GB3730@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17072012-0040-0000-0000-000003833D5D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007392; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00890284; UDB=6.00444784; IPR=6.00670452; BA=6.00005481; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016296; XFM=3.00000015; UTC=2017-07-20 12:50:59 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072012-0041-0000-0000-00000777555F Message-Id: <20170720125054.GN3730@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-20_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707200198 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2459 Lines: 66 On Thu, Jul 20, 2017 at 09:40:49AM +0800, Li, Aubrey wrote: > On 2017/7/19 22:48, Paul E. McKenney wrote: > > On Wed, Jul 19, 2017 at 01:44:06PM +0800, Li, Aubrey wrote: > >> On 2017/7/18 23:20, Paul E. McKenney wrote: > >> > >>>> 2) for rcu idle enter/exit, I measured the details which Paul provided, and > >>>> the result matches with what I have measured before, nothing notable found. > >>>> But it still makes more sense if we can make rcu idle enter/exit hooked with > >>>> tick off. (it's possible other workloads behave differently) > >>> > >>> Again, assuming that RCU is informed of CPUs in the kernel, regardless > >>> of whether or not the tick is on that that point in time. > >>> > >> Yeah, I see, no problem for a normal idle. > >> > >> But for a short idle, we want to return to the task ASAP. Even though RCU cost > >> is not notable, it would still be better for me if we can save some cycles in > >> idle entry and idle exit. > >> > >> Do we have any problem if we skip RCU idle enter/exit under a fast idle scenario? > >> My understanding is, if tick is not stopped, then we don't need inform RCU in > >> idle path, it can be informed in irq exit. > > > > Indeed, the problem arises when the tick is stopped. > > My question is, does problem arise when the tick is *not* stopped (skipping nohz idle)? > > instead of > > static void cpuidle_idle_call() > { > rcu_idle_enter() > ...... > rcu_idle_exit() > } > > I want > > static void cpuidle_idle_call() > { > if (tick stopped) > rcu_idle_enter() > ...... > if (tick stopped) > rcu_idle_exit() > } > > Or checking tick stop can be put into rcu_idle_enter/exit The answer is the traditional "it depends". If the above change was all that you did, that would be a bug in the case where the predicted short idle time turned out to in reality be an indefinite idle time. RCU would indefinitely believe that the CPU was non-idle, and would wait for it to report a quiescent state, which it would not, even given the scheduling-clock interrupt (it is idle, so it knows RCU already knows that it is idle, you see). RCU would eventually send it a resched IPI, which would probably get things going again, but the best you could hope for was extra resched IPIs and excessively long grace periods. To make this work reasonably, you would also need some way to check for the case where the prediction idle time is short but the real idle time is very long. Thanx, Paul