Commit 7ca263cdf8cf74d0f1c6f48d07d556de92e3bec9

Authored by Linus Torvalds

Merge branch 'cputime' of git://git390.marist.edu/pub/scm/linux-2.6

* 'cputime' of git://git390.marist.edu/pub/scm/linux-2.6:
  [PATCH] Fix idle time field in /proc/uptime

Showing 1 changed file Side-by-side Diff

... ... @@ -4,13 +4,18 @@
4 4 #include <linux/sched.h>
5 5 #include <linux/seq_file.h>
6 6 #include <linux/time.h>
  7 +#include <linux/kernel_stat.h>
7 8 #include <asm/cputime.h>
8 9  
9 10 static int uptime_proc_show(struct seq_file *m, void *v)
10 11 {
11 12 struct timespec uptime;
12 13 struct timespec idle;
13   - cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
  14 + int i;
  15 + cputime_t idletime = cputime_zero;
  16 +
  17 + for_each_possible_cpu(i)
  18 + idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle);
14 19  
15 20 do_posix_clock_monotonic_gettime(&uptime);
16 21 monotonic_to_bootbased(&uptime);