]> www.infradead.org Git - users/jedix/linux-maple.git/commit
proc: Consider NO_HZ when printing idle and iowait times
authorMichal Hocko <mhocko@suse.cz>
Wed, 24 Aug 2011 07:40:25 +0000 (09:40 +0200)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Fri, 9 Nov 2012 12:37:55 +0000 (04:37 -0800)
commitc86e33352b2fc97a63f523b6571d25685b22eef9
tree61f3ea3313f6bfcda70b628532e2b66a4e9d4648
parent12a30c71e506acde70d00737a2b14ba4dd98da33
proc: Consider NO_HZ when printing idle and iowait times

Orabug: 14779047
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: Alexey Dobriyan <adobriyan@gmail.com>
Link: http://lkml.kernel.org/r/39181366adac1b39cb6aa3cd53ff0f7c78d32676.1314172057.git.mhocko@suse.cz
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
fs/proc/stat.c