Files
linux/fs
Josh Don a130e8fbc7 fs/proc/uptime.c: Fix idle time reporting in /proc/uptime
/proc/uptime reports idle time by reading the CPUTIME_IDLE field from
the per-cpu kcpustats. However, on NO_HZ systems, idle time is not
continually updated on idle cpus, leading this value to appear
incorrectly small.

/proc/stat performs an accounting update when reading idle time; we
can use the same approach for uptime.

With this patch, /proc/stat and /proc/uptime now agree on idle time.
Additionally, the following shows idle time tick up consistently on an
idle machine:

  (while true; do cat /proc/uptime; sleep 1; done) | awk '{print $2-prev; prev=$2}'

Reported-by: Luigi Rizzo <lrizzo@google.com>
Signed-off-by: Josh Don <joshdon@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lkml.kernel.org/r/20210827165438.3280779-1-joshdon@google.com
2021-10-05 15:51:35 +02:00
..
2021-08-19 09:02:55 +09:00
2021-04-12 15:04:29 +02:00
2021-08-26 22:28:02 +02:00
2021-07-06 20:14:41 -04:00
2021-09-10 09:46:48 -07:00
2021-08-18 22:08:24 +02:00
2021-06-29 10:53:48 -07:00
2021-08-16 10:50:32 -06:00
2021-08-19 09:02:55 +09:00
2021-01-24 14:27:19 +01:00
2021-10-01 11:16:02 -06:00
2021-06-29 10:53:48 -07:00
2021-08-18 22:08:24 +02:00
2021-02-13 17:17:53 +01:00
2021-08-10 17:57:22 +02:00
2021-01-24 14:27:18 +01:00