X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=fs%2Fproc%2Fstat.c;h=81a48d1c36eff63bc53cfb33844d6d703034f1f5;hp=2a30d67dd6b81ea03c71b3bdea4fa50913a09ae4;hb=277d8276eec6c1861bff8d08c4f0d67d7a9185f1;hpb=72784134ce53b8e40deb8c9981ec52122d9f6208 diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 2a30d67dd6b8..81a48d1c36ef 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c @@ -24,29 +24,35 @@ static cputime64_t get_idle_time(int cpu) { - u64 idle_time = get_cpu_idle_time_us(cpu, NULL); + u64 idle_time = -1ULL; cputime64_t idle; + 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 = kstat_cpu(cpu).cpustat.idle; idle = cputime64_add(idle, arch_idle_time(cpu)); } else - idle = nsecs_to_jiffies64(1000 * idle_time); + idle = usecs_to_cputime64(idle_time); return idle; } static cputime64_t get_iowait_time(int cpu) { - u64 iowait_time = get_cpu_iowait_time_us(cpu, NULL); + u64 iowait_time = -1ULL; cputime64_t iowait; + 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 = kstat_cpu(cpu).cpustat.iowait; else - iowait = nsecs_to_jiffies64(1000 * iowait_time); + iowait = usecs_to_cputime64(iowait_time); return iowait; } @@ -135,7 +141,7 @@ static int show_stat(struct seq_file *p, void *v) /* sum again ? it could be updated? */ for_each_irq_nr(j) - seq_printf(p, " %u", kstat_irqs(j)); + seq_printf(p, " %u", kstat_irqs_usr(j)); seq_printf(p, "\nctxt %llu\n"