From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751636AbdJPGDx (ORCPT ); Mon, 16 Oct 2017 02:03:53 -0400 Received: from mga05.intel.com ([192.55.52.43]:47000 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750821AbdJPGDw (ORCPT ); Mon, 16 Oct 2017 02:03:52 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,385,1503385200"; d="scan'208";a="163038927" Subject: Re: [RFC PATCH v2 7/8] cpuidle: introduce irq timing to make idle prediction To: "Rafael J. Wysocki" , Aubrey Li Cc: tglx@linutronix.de, peterz@infradead.org, len.brown@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, x86@kernel.org, linux-kernel@vger.kernel.org References: <1506756034-6340-1-git-send-email-aubrey.li@intel.com> <1506756034-6340-8-git-send-email-aubrey.li@intel.com> <1759699.pn1NT78COC@aspire.rjw.lan> From: "Li, Aubrey" Message-ID: <8044fbf6-5285-d0eb-9e71-f2307c6c0fda@linux.intel.com> Date: Mon, 16 Oct 2017 14:03:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <1759699.pn1NT78COC@aspire.rjw.lan> 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 On 2017/10/14 9:01, Rafael J. Wysocki wrote: > On Saturday, September 30, 2017 9:20:33 AM CEST Aubrey Li wrote: >> Introduce irq timings output as a factor to predict the duration >> of the coming idle >> >> @@ -342,13 +343,27 @@ void cpuidle_entry_end(void) >> void cpuidle_predict(void) >> { >> struct cpuidle_device *dev = cpuidle_get_device(); >> - unsigned int overhead_threshold; >> + unsigned int idle_interval, overhead_threshold; >> + u64 now, next_evt; >> >> if (!dev) >> return; >> >> overhead_threshold = dev->idle_stat.overhead * sysctl_fast_idle_ratio; >> >> + /* >> + * check irq timings if the next event is coming soon >> + */ >> + now = local_clock(); >> + local_irq_disable(); >> + next_evt = irq_timings_next_event(now); >> + local_irq_enable(); >> + idle_interval = div_u64(next_evt - now, NSEC_PER_USEC); > > Another division ... > okay, will replace with >>10 if micro-second is agreed to be the comparing unit Thanks, -Aubrey