summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorBo Yan <byan@nvidia.com>2013-03-22 14:03:26 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 13:05:03 -0700
commit24f91fd6ab45c594fdf9840d0eaa228993db46e3 (patch)
tree9b9536b696c5363587ad211d0381d392757282e4 /kernel
parent5e0ed47f6efadca65492ae4c5cccabe2213e8738 (diff)
nohz: stat: Fix CPU idle time accounting
Since cpustat[CPUTIME_IDLE] is never connected to ts->idle_sleeptime, never read from cpustat[CPUTIME_IDLE] when reporting stats in /proc/stat. Note this was rejected by Michal Hocko when it was initially proposed by Martin Schwidefsky in LKML, so if you want to upstream it, better find an alternative (either completely disable cpustat[CPUTIME_IDLE] for CONFIG_NO_HZ or somehow connect them to keep them in sync.) bug 1190321 Change-Id: Idc92488910b826aff850a010016d8326c7ab9e6c Signed-off-by: Bo Yan <byan@nvidia.com> Reviewed-on: http://git-master/r/212224 (cherry picked from commit e7a9220f5883bf3816e24895a34239a34a7d9ece) Reviewed-on: http://git-master/r/212907 GVS: Gerrit_Virtual_Submit Reviewed-by: Liang Cheng (SW) <licheng@nvidia.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/tick-sched.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 4251374578bc..da00c96989d3 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -482,7 +482,7 @@ u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time)
update_ts_time_stats(cpu, ts, now, last_update_time);
idle = ts->idle_sleeptime;
} else {
- if (ts->idle_active && !nr_iowait_cpu(cpu)) {
+ if (cpu_online(cpu) && ts->idle_active && !nr_iowait_cpu(cpu)) {
ktime_t delta = ktime_sub(now, ts->idle_entrytime);
idle = ktime_add(ts->idle_sleeptime, delta);
@@ -523,7 +523,8 @@ u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time)
update_ts_time_stats(cpu, ts, now, last_update_time);
iowait = ts->iowait_sleeptime;
} else {
- if (ts->idle_active && nr_iowait_cpu(cpu) > 0) {
+ if (cpu_online(cpu) && ts->idle_active &&
+ nr_iowait_cpu(cpu) > 0) {
ktime_t delta = ktime_sub(now, ts->idle_entrytime);
iowait = ktime_add(ts->iowait_sleeptime, delta);