sched_clock: fix NOHZ interaction
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Mon, 1 Sep 2008 14:44:23 +0000 (16:44 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 5 Sep 2008 16:14:08 +0000 (18:14 +0200)
If HLT stops the TSC, we'll fail to account idle time, thereby inflating the
actual process times. Fix this by re-calibrating the clock against GTOD when
leaving nohz mode.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Tested-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/time/tick-sched.c

index 7a46bde..a87b046 100644 (file)
@@ -162,6 +162,8 @@ void tick_nohz_stop_idle(int cpu)
                ts->idle_lastupdate = now;
                ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
                ts->idle_active = 0;
+
+               sched_clock_idle_wakeup_event(0);
        }
 }
 
@@ -177,6 +179,7 @@ static ktime_t tick_nohz_start_idle(struct tick_sched *ts)
        }
        ts->idle_entrytime = now;
        ts->idle_active = 1;
+       sched_clock_idle_sleep_event();
        return now;
 }