diff options
author | Sai Gurrappadi <sgurrappadi@nvidia.com> | 2014-06-03 17:46:23 -0700 |
---|---|---|
committer | Mandar Padmawar <mpadmawar@nvidia.com> | 2014-06-06 07:27:12 -0700 |
commit | c97b9f5d0cd158194507750b11701c5ae5c80871 (patch) | |
tree | c29f431a0a9e8053e8184981d7379ebc21ed06f8 /fs | |
parent | cc0d4317057d190d465e1890c2aed29aef84762d (diff) |
nohz: stat: Fix decreasing idle/iowait times
Always read nohz idle/iowait counters if nohz is enabled even if the cpu
is offline. This prevents a decreasing counter if a reader reads
/proc/stat before and after a cpu is offlined. Currently /proc/stat
switches between using the nohz counters and the sched-tick counters
both of which are updated independently and could therefore be out of
sync.
Commit "7386cdb nohz: Fix idle ticks in cpu summary line of /proc/stat"
introduced the check to fall back onto using the sched-tick counters
because the nohz counters updated incorrectly when a cpu was offlined.
However, commit "4b0c0f2 tick: Cleanup NOHZ per cpu data on cpu down"
properly fixes the issue by clearing nohz state on cpu-down thereby
preventing faulty nohz counter updates. So we can now safely remove the
cpu_online() checks introduced by 7386cdb.
Bug 200007081
Bug 1512875
Change-Id: I7182f2cc9f36e2019c72522f76cac44a59e8b913
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/419540
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/stat.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 36a15504b6e9..13cbc70b5657 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c @@ -47,11 +47,10 @@ static u64 get_idle_time(int cpu) { u64 idle, idle_time = -1ULL; - if (cpu_online(cpu)) - idle_time = get_cpu_idle_time_us(cpu, NULL); + idle_time = get_cpu_idle_time_us(cpu, NULL); if (idle_time == -1ULL) - /* !NO_HZ or cpu offline so we can rely on cpustat.idle */ + /* !NO_HZ so we can rely on cpustat.idle */ idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; else idle = usecs_to_cputime64(idle_time); @@ -63,11 +62,10 @@ static u64 get_iowait_time(int cpu) { u64 iowait, iowait_time = -1ULL; - if (cpu_online(cpu)) - iowait_time = get_cpu_iowait_time_us(cpu, NULL); + iowait_time = get_cpu_iowait_time_us(cpu, NULL); if (iowait_time == -1ULL) - /* !NO_HZ or cpu offline so we can rely on cpustat.iowait */ + /* !NO_HZ so we can rely on cpustat.iowait */ iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; else iowait = usecs_to_cputime64(iowait_time); |