[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linaro-sched-sig
Subject:    [PATCH 28/41] nohz: Don't restart the tick before scheduling to idle
From:       fweisbec () gmail ! com (Frederic Weisbecker)
Date:       2012-04-30 23:55:02
Message-ID: 1335830115-14335-29-git-send-email-fweisbec () gmail ! com
[Download RAW message or body]

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 <fweisbec at gmail.com>
Cc: Alessio Igor Bogani <abogani at kernel.org>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Avi Kivity <avi at redhat.com>
Cc: Chris Metcalf <cmetcalf at tilera.com>
Cc: Christoph Lameter <cl at linux.com>
Cc: Daniel Lezcano <daniel.lezcano at linaro.org>
Cc: Geoff Levand <geoff at infradead.org>
Cc: Gilad Ben Yossef <gilad at benyossef.com>
Cc: Hakan Akkan <hakanakkan at gmail.com>
Cc: Ingo Molnar <mingo at kernel.org>
Cc: Kevin Hilman <khilman at ti.com>
Cc: Max Krasnyansky <maxk at qualcomm.com>
Cc: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Stephen Hemminger <shemminger at vyatta.com>
Cc: Steven Rostedt <rostedt at goodmis.org>
Cc: Sven-Thorsten Dietrich <thebigcorporation at gmail.com>
Cc: Thomas Gleixner <tglx at linutronix.de>
---
 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 5933506..8217409 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -1029,14 +1029,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



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic