Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752113AbbKPWbK (ORCPT ); Mon, 16 Nov 2015 17:31:10 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:45697 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751387AbbKPWbH (ORCPT ); Mon, 16 Nov 2015 17:31:07 -0500 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Mon, 16 Nov 2015 14:31:17 -0800 From: "Paul E. McKenney" To: Jacob Pan Cc: Thomas Gleixner , Peter Zijlstra , Ingo Molnar , John Stultz , LKML , Arjan van de Ven , Srinivas Pandruvada , Len Brown , Rafael Wysocki , Eduardo Valentin , Paul Turner , Josh Triplett Subject: Re: [PATCH 2/4] timer: relax tick stop in idle entry Message-ID: <20151116223117.GK5184@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1447444387-23525-1-git-send-email-jacob.jun.pan@linux.intel.com> <1447444387-23525-3-git-send-email-jacob.jun.pan@linux.intel.com> <20151113142438.3144d47d@icelake> <20151116135126.5a50e45d@icelake> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151116135126.5a50e45d@icelake> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15111622-0013-0000-0000-00001A488F3B Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2681 Lines: 63 On Mon, Nov 16, 2015 at 01:51:26PM -0800, Jacob Pan wrote: > On Mon, 16 Nov 2015 16:06:57 +0100 (CET) > Thomas Gleixner wrote: > > > > -0 [000] 30.093474: bprint: > > > __tick_nohz_idle_enter: JPAN: tick_nohz_stop_sched_tick 609 delta > > > 1000000 [JP] but sees delta is exactly 1 tick away. didn't stop > > > tick. > > > > If the delta is 1 tick then it is not supposed to stop it. Did you > > ever try to figure out WHY it is 1 tick? > > > > There are two code pathes which can set it to basemono + TICK_NSEC: > > > > if (rcu_needs_cpu(basemono, &next_rcu) || > > arch_needs_cpu() || irq_work_needs_cpu()) { > > next_tick = basemono + TICK_NSEC; > > } else { > > next_tmr = get_next_timer_interrupt(basejiff, > > basemono); ts->next_timer = next_tmr; > > /* Take the next rcu event into account */ > > next_tick = next_rcu < next_tmr ? next_rcu : next_tmr; > > } > > > > Can you please figure out WHY the tick is requested to continue > > instead of blindly wreckaging the logic in that code? > > Looks like the it hits in both cases during forced idle. > + Josh > + Paul > > For the first case, it is always related to RCU. I found there are two > CONFIG options to avoid this undesired tick in idle loop. > 1. enable CONFIG_RCU_NOCB_CPU_ALL, offload to orcu kthreads > 2. or enable CONFIG_RCU_FAST_NO_HZ (enter dytick idle w/ rcu callback) > > Either one works but my concern is that users may not realize the > intricate CONFIG_ options and how they translate into energy savings. > Consulted with Josh, it seems we could add a check here to recognize > the forced idle state and relax rcu_needs_cpu() to return false even it > has callbacks. Since we are blocking everybody for a short time (5 ticks > default). It should not impact synchronize and kfree rcu. Or we could just set things up so that whatever Kconfig you are using to enable this state causes CONFIG_RCU_NOCB_CPU_ALL to also be enabled. Or that causes CONFIG_RCU_FAST_NO_HZ to also be enabled, if that works better for you. Just out of curiosity, what is the purpose of the forced idle state? Thermal control or some such? Thanx, Paul > For the second case, which is much more rare, I think we do have next > timer exactly one tick away. Just don't know why tick will continue into > idle loop. > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/