]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
tick: Don't clear idle and iowait sums on CPU down
authorSai Gurrappadi <sgurrappadi@nvidia.com>
Wed, 26 Mar 2014 03:45:38 +0000 (20:45 -0700)
committerDiwakar Tundlam <dtundlam@nvidia.com>
Wed, 2 Apr 2014 19:11:24 +0000 (12:11 -0700)
NOHZ related per-cpu data is cleared on CPU down. This was introduced by
4b0c0f294 "tick: Cleanup NOHZ per cpu data on cpu down" which breaks
/proc/stats because the idle and iowait sums are now non-monotonic
across a CPU down/up cycle.

Fix this by not clearing the idle_sleeptime and iowait_sleeptime fields
on CPU down.

Bug 1484092

Change-Id: Ia57f5690672c0f35cf36098f92f242b94b545bb7
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/386664
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
kernel/time/tick-sched.c

index da00c96989d3079596d8c5f0cdd74185905bb1e2..73b332ef4a56f714c89dc8d63b73e29e75012a07 100644 (file)
@@ -1156,6 +1156,17 @@ void tick_setup_sched_timer(void)
 #endif /* HIGH_RES_TIMERS */
 
 #if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS
+
+static inline void clear_tick_sched(struct tick_sched *ts)
+{
+       ktime_t idle_sleeptime = ts->idle_sleeptime;
+       ktime_t iowait_sleeptime = ts->iowait_sleeptime;
+
+       memset(ts, 0, sizeof(*ts));
+       ts->idle_sleeptime = idle_sleeptime;
+       ts->iowait_sleeptime = iowait_sleeptime;
+}
+
 void tick_cancel_sched_timer(int cpu)
 {
        struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
@@ -1165,7 +1176,7 @@ void tick_cancel_sched_timer(int cpu)
                hrtimer_cancel(&ts->sched_timer);
 # endif
 
-       memset(ts, 0, sizeof(*ts));
+       clear_tick_sched(ts);
 }
 #endif