Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753401AbdGND4i (ORCPT ); Thu, 13 Jul 2017 23:56:38 -0400 Received: from mga03.intel.com ([134.134.136.65]:3998 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753059AbdGND4h (ORCPT ); Thu, 13 Jul 2017 23:56:37 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,357,1496127600"; d="scan'208";a="127169593" Subject: Re: [RFC PATCH v1 00/11] Create fast idle path for short idle periods To: Peter Zijlstra Cc: Andi Kleen , Frederic Weisbecker , Christoph Lameter , Aubrey Li , tglx@linutronix.de, len.brown@intel.com, rjw@rjwysocki.net, tim.c.chen@linux.intel.com, arjan@linux.intel.com, paulmck@linux.vnet.ibm.com, yang.zhang.wz@gmail.com, x86@kernel.org, linux-kernel@vger.kernel.org References: <20170711094157.5xcwkloxnjehieqv@hirez.programming.kicks-ass.net> <20170711160926.GA18805@lerouge> <20170711163422.etydkhhtgfthpfi5@hirez.programming.kicks-ass.net> <496d4921-5768-cd1e-654b-38630b7d2e13@linux.intel.com> <20170712083410.ualmvnvzoohyami5@hirez.programming.kicks-ass.net> <20170712213240.GE3441@tassilo.jf.intel.com> <20170713083649.febfflfl5hafkko5@hirez.programming.kicks-ass.net> <16e12e23-6b28-f174-7c4b-4d719225cd3b@linux.intel.com> <20170713145311.z4zxlyd2dospeoqg@hirez.programming.kicks-ass.net> <4a577bd6-20b1-abb6-2153-f9870f0a721e@linux.intel.com> <20170713182820.sn3fjitnd3mca27p@hirez.programming.kicks-ass.net> From: "Li, Aubrey" Message-ID: <31170ac6-9db1-f0b8-4841-f1661c8ed6e1@linux.intel.com> Date: Fri, 14 Jul 2017 11:56:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170713182820.sn3fjitnd3mca27p@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1426 Lines: 36 On 2017/7/14 2:28, Peter Zijlstra wrote: > On Thu, Jul 13, 2017 at 11:13:28PM +0800, Li, Aubrey wrote: >> On 2017/7/13 22:53, Peter Zijlstra wrote: > >>> Fixing C-state selection by creating an alternative idle path sounds so >>> very wrong. >> >> This only happens on the arch which has multiple hardware idle cstates, like >> Intel's processor. As long as we want to support multiple cstates, we have to >> make a selection(with cost of timestamp update and computation). That's fine >> in the normal idle path, but if we want a fast idle switch, we can make a >> tradeoff to use a low-latency one directly, that's why I proposed a fast idle >> path, so that we don't need to mix fast idle condition judgement in both idle >> entry and idle exit path. > > That doesn't make sense. If you can decide to pick a shallow C state in > any way, you can fix the general selection too. > Okay, maybe something like the following make sense? Give a hint to cpuidle_idle_call() to indicate a fast idle. -------------------------------------------------------- diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index ef63adc..3165e99 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -152,7 +152,7 @@ static void cpuidle_idle_call(void) */ rcu_idle_enter(); - if (cpuidle_not_available(drv, dev)) { + if (cpuidle_not_available(drv, dev) || this_is_a_fast_idle) { default_idle_call(); goto exit_idle; }