From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031130Ab2CUOAY (ORCPT ); Wed, 21 Mar 2012 10:00:24 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:61813 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031108Ab2CUOAR (ORCPT ); Wed, 21 Mar 2012 10:00:17 -0400 From: Frederic Weisbecker To: LKML , linaro-sched-sig@lists.linaro.org Cc: Frederic Weisbecker , Alessio Igor Bogani , Andrew Morton , Avi Kivity , Chris Metcalf , Christoph Lameter , Daniel Lezcano , Geoff Levand , Gilad Ben Yossef , Ingo Molnar , Max Krasnyansky , "Paul E. McKenney" , Peter Zijlstra , Stephen Hemminger , Steven Rostedt , Sven-Thorsten Dietrich , Thomas Gleixner , Zen Lin Subject: [PATCH 27/32] nohz: Don't restart the tick before scheduling to idle Date: Wed, 21 Mar 2012 14:58:33 +0100 Message-Id: <1332338318-5958-29-git-send-email-fweisbec@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1332338318-5958-1-git-send-email-fweisbec@gmail.com> References: <1332338318-5958-1-git-send-email-fweisbec@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we were running adaptive tickless but then we schedule out and enter the idle task, we don't need to restart the tick because tick_nohz_idle_enter() is going to be called right away. The only thing we need to do is to save the jiffies such that when we later restart the tick we can account the CPU time spent while idle was tickless. Signed-off-by: Frederic Weisbecker Cc: Alessio Igor Bogani Cc: Andrew Morton Cc: Avi Kivity Cc: Chris Metcalf Cc: Christoph Lameter Cc: Daniel Lezcano Cc: Geoff Levand Cc: Gilad Ben Yossef Cc: Ingo Molnar Cc: Max Krasnyansky Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Stephen Hemminger Cc: Steven Rostedt Cc: Sven-Thorsten Dietrich Cc: Thomas Gleixner Cc: Zen Lin --- kernel/time/tick-sched.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 6706a7d..4b9bdfb 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1027,14 +1027,18 @@ void tick_nohz_pre_schedule(void) void tick_nohz_post_schedule(void) { struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); + unsigned long flags; - /* - * No need to disable irqs here. The worst that can happen - * is an irq that comes and restart the tick before us. - * tick_nohz_restart_sched_tick() is irq safe. - */ - if (ts->tick_stopped) - tick_nohz_restart_sched_tick(); + local_irq_save(flags); + if (ts->tick_stopped) { + if (is_idle_task(current)) { + ts->saved_jiffies = jiffies; + ts->saved_jiffies_whence = JIFFIES_SAVED_IDLE; + } else { + tick_nohz_restart_sched_tick(); + } + } + local_irq_restore(flags); } void tick_nohz_flush_current_times(bool restart_tick) -- 1.7.5.4