]> git.karo-electronics.de Git - karo-tx-linux.git/commit
show_stat handler of the /proc/stat file relies on kstat_cpu(cpu)
authorMichal Hocko <mhocko@suse.cz>
Wed, 24 Aug 2011 23:46:24 +0000 (09:46 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 9 Sep 2011 06:16:03 +0000 (16:16 +1000)
commita93641503152b8c4401aee9bfc9b7909a8a94e34
tree42b6cf200ebf4c19128da568acff9f78e950b290
parentb2ed411cf486bdacdabae36200a251a2e6dc5d68
show_stat handler of the /proc/stat file relies on kstat_cpu(cpu)
statistics when priting information about idle and iowait times.  This is
OK if we are not using tickless kernel (CONFIG_NO_HZ) because counters are
updated periodically.

With NO_HZ things got more tricky because we are not doing idle/iowait
accounting while we are tickless so the value might get outdated.  Users
of /proc/stat will notice that by unchanged idle/iowait values which is
then interpreted as 0% idle/iowait time.  From the user space POV this is
an unexpected behavior and a change of the interface.

Let's fix this by using get_cpu_{idle,iowait}_time_us which accounts the
total idle/iowait time since boot and it doesn't rely on sampling or any
other periodic activity.  Fall back to the previous behavior if NO_HZ is
disabled or not configured.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Cc: Dave Jones <davej@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/stat.c