diff options
author | Michael Abbott <michael.abbott@diamond.ac.uk> | 2009-09-24 10:15:19 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-10-05 08:28:03 -0700 |
commit | ec49bc1bdc7c6e92873373ff61206c366d63a50a (patch) | |
tree | 3982bb6dfa17c9e0ef1698e4cded9fbb1ea738ff | |
parent | 1590abee1d64ba508d6c3dab7953b4c2fe71c50d (diff) | |
download | lwn-ec49bc1bdc7c6e92873373ff61206c366d63a50a.tar.gz lwn-ec49bc1bdc7c6e92873373ff61206c366d63a50a.zip |
Fix idle time field in /proc/uptime
commit 96830a57de1197519b62af6a4c9ceea556c18c3d upstream.
Git commit 79741dd changes idle cputime accounting, but unfortunately
the /proc/uptime file hasn't caught up. Here the idle time calculation
from /proc/stat is copied over.
Signed-off-by: Michael Abbott <michael.abbott@diamond.ac.uk>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | fs/proc/uptime.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index 0c10a0b3f146..766b1d456050 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c @@ -4,13 +4,18 @@ #include <linux/sched.h> #include <linux/seq_file.h> #include <linux/time.h> +#include <linux/kernel_stat.h> #include <asm/cputime.h> static int uptime_proc_show(struct seq_file *m, void *v) { struct timespec uptime; struct timespec idle; - cputime_t idletime = cputime_add(init_task.utime, init_task.stime); + int i; + cputime_t idletime = cputime_zero; + + for_each_possible_cpu(i) + idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle); do_posix_clock_monotonic_gettime(&uptime); monotonic_to_bootbased(&uptime); |