diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-16 22:27:58 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-16 22:27:58 -0500 |
| commit | d05f06e60df4f56a70fb8a3e46335b40687169e9 (patch) | |
| tree | c1eec6749fed86a21b08606e1e4acefe4b033253 /fs/proc/stat.c | |
| parent | 0af1c5300db31f25a412e6e83d42b1747d56c9de (diff) | |
| parent | 1d72d9f83df057e71c7951def41138a0230bf737 (diff) | |
Merge branch 'arch-frv' into no-rebases
Diffstat (limited to 'fs/proc/stat.c')
| -rw-r--r-- | fs/proc/stat.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 64c3b3172367..e296572c73ed 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c @@ -45,10 +45,13 @@ static cputime64_t get_iowait_time(int cpu) static u64 get_idle_time(int cpu) { - u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL); + u64 idle, idle_time = -1ULL; + + if (cpu_online(cpu)) + idle_time = get_cpu_idle_time_us(cpu, NULL); if (idle_time == -1ULL) - /* !NO_HZ so we can rely on cpustat.idle */ + /* !NO_HZ or cpu offline so we can rely on cpustat.idle */ idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; else idle = usecs_to_cputime64(idle_time); @@ -58,10 +61,13 @@ static u64 get_idle_time(int cpu) static u64 get_iowait_time(int cpu) { - u64 iowait, iowait_time = get_cpu_iowait_time_us(cpu, NULL); + u64 iowait, iowait_time = -1ULL; + + if (cpu_online(cpu)) + iowait_time = get_cpu_iowait_time_us(cpu, NULL); if (iowait_time == -1ULL) - /* !NO_HZ so we can rely on cpustat.iowait */ + /* !NO_HZ or cpu offline so we can rely on cpustat.iowait */ iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; else iowait = usecs_to_cputime64(iowait_time); |
