tick: Don't clear idle and iowait sums on CPU down
PATCH 1/1 tick: Don't clear idle and iowait sums on CPU down
From: Sai Gurrappadi <[email protected]>
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.
Signed-off-by Sai Gurrappadi <[email protected]>
Signed-off-by Peter De Schrijver <[email protected]>
--- kernel/time/tick-sched.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
kernel/time/tick-sched.c +12 -1
@@ -1164,6 +1164,17 @@ void tick_setup_sched_timer(void)#endif /* HIGH_RES_TIMERS */ #if definedCONFIG_NO_HZ_COMMON || definedCONFIG_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);
@@ -1173,7 +1184,7 @@ void tick_cancel_sched_timer(int cpu)hrtimer_cancel (&ts->sched_timer);# endif - memset(ts, 0, sizeof(*ts)); + clear_tick_sched(ts); }#endif
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty