Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753357AbdGJBtL (ORCPT ); Sun, 9 Jul 2017 21:49:11 -0400 Received: from mga06.intel.com ([134.134.136.31]:24495 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753305AbdGJBtE (ORCPT ); Sun, 9 Jul 2017 21:49:04 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,337,1496127600"; d="scan'208";a="1193388623" From: Aubrey Li To: tglx@linutronix.de, peterz@infradead.org, len.brown@intel.com, rjw@rjwysocki.net, ak@linux.intel.com, tim.c.chen@linux.intel.com, arjan@linux.intel.com, paulmck@linux.vnet.ibm.com, yang.zhang.wz@gmail.com Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Aubrey Li Subject: [RFC PATCH v1 06/11] timers: keep sleep length updated as needed Date: Mon, 10 Jul 2017 09:38:36 +0800 Message-Id: <1499650721-5928-7-git-send-email-aubrey.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499650721-5928-1-git-send-email-aubrey.li@intel.com> References: <1499650721-5928-1-git-send-email-aubrey.li@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 817 Lines: 27 From: Aubrey Li sleep length indicates how long we'll be idle. Currently, it's updated only when tick nohz enters. These patch series make a new requirement with tick, so we should keep sleep length updated as needed --- kernel/time/tick-sched.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 7fe53be..8bf6e8b 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -988,8 +988,11 @@ void tick_nohz_irq_exit(void) */ ktime_t tick_nohz_get_sleep_length(void) { + struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); + ts->sleep_length = ktime_sub(dev->next_event, ktime_get()); + return ts->sleep_length; } -- 2.7.4