Re: [RFC][PATCH] /proc/stat idle field for idle cpus

From: Andrew Morton
Date: Fri Apr 17 2009 - 19:10:26 EST


On Tue, 14 Apr 2009 14:18:51 +0200
Martin Schwidefsky <schwidefsky@xxxxxxxxxx> wrote:

> --- linux-2.6.orig/fs/proc/stat.c
> +++ linux-2.6/fs/proc/stat.c
> @@ -18,6 +18,9 @@
> #ifndef arch_irq_stat
> #define arch_irq_stat() 0
> #endif
> +#ifndef arch_idle_time
> +#define arch_idle_time(cpu) 0
> +#endif
>
> static int show_stat(struct seq_file *p, void *v)
> {
> @@ -39,7 +42,8 @@ static int show_stat(struct seq_file *p,
> user = cputime64_add(user, kstat_cpu(i).cpustat.user);
> nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
> system = cputime64_add(system, kstat_cpu(i).cpustat.system);
> - idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle);
> + idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle +
> + arch_idle_time(i));
> iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait);
> irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
> softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
> @@ -68,7 +72,7 @@ static int show_stat(struct seq_file *p,
> user = kstat_cpu(i).cpustat.user;
> nice = kstat_cpu(i).cpustat.nice;
> system = kstat_cpu(i).cpustat.system;
> - idle = kstat_cpu(i).cpustat.idle;
> + idle = kstat_cpu(i).cpustat.idle + arch_idle_time(i);
> iowait = kstat_cpu(i).cpustat.iowait;
> irq = kstat_cpu(i).cpustat.irq;
> softirq = kstat_cpu(i).cpustat.softirq;

Looks OK to me. Please merge it via the s390 tree.

Do other architectures need to fix this?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/