From: Michael Abbott Date: Thu, 24 Sep 2009 08:15:19 +0000 (+0200) Subject: [PATCH] Fix idle time field in /proc/uptime X-Git-Tag: firefly_0821_release~12334^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=96830a57de1197519b62af6a4c9ceea556c18c3d;p=firefly-linux-kernel-4.4.55.git [PATCH] Fix idle time field in /proc/uptime 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 Signed-off-by: Martin Schwidefsky --- 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 #include #include +#include #include 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);