]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched/cputime: Provide get_cpu_[idle|iowait]_time_us() off-case
authorFrederic Weisbecker <frederic@kernel.org>
Fri, 8 May 2026 13:16:45 +0000 (15:16 +0200)
committerThomas Gleixner <tglx@kernel.org>
Tue, 2 Jun 2026 19:27:26 +0000 (21:27 +0200)
commit3b45b4f188f3a0ebd16ab71efd2ffcc7a16ad861
treeb51b82e3b7602d9c72f1f69e2810fb2ff3e05de5
parent127b2eb44f36d5d7059f1af425b5800cb27440f9
sched/cputime: Provide get_cpu_[idle|iowait]_time_us() off-case

The last reason why get_cpu_idle/iowait_time_us() may return -1 now is if
the config doesn't support nohz.

The ad-hoc replacement solution by cpufreq is to compute jiffies minus the
whole busy cputime. Although the intention should provide a coherent low
resolution estimation of the idle and iowait time, the implementation is
buggy because jiffies don't start at 0.

Just provide instead a real get_cpu_[idle|iowait]_time_us() offcase.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Link: https://patch.msgid.link/20260508131647.43868-14-frederic@kernel.org
drivers/cpufreq/cpufreq.c
include/linux/kernel_stat.h
include/linux/tick.h
kernel/sched/cputime.c