[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251129133526.1460119-1-jackzxcui1989@163.com>
Date: Sat, 29 Nov 2025 21:35:24 +0800
From: Xin Zhao <jackzxcui1989@....com>
To: anna-maria@...utronix.de,
frederic@...nel.org,
mingo@...nel.org,
tglx@...utronix.de,
kuba@...nel.org
Cc: jackzxcui1989@....com,
linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: [PATCH 0/2] Optimize /proc/stat idle/iowait fluctuation
The idle and iowait statistics in /proc/stat are obtained through
get_idle_time and get_iowait_time. Assuming CONFIG_NO_HZ_COMMON is
enabled, when CPU is online, the idle and iowait values use the
idle_sleeptime and iowait_sleeptime statistics from tick_cpu_sched, but
use CPUTIME_IDLE and CPUTIME_IOWAIT items from kernel_cpustat when CPU
is offline. It will cause idle/iowait fluctuation in the aggregated
statistics print by /proc/stat.
Introduce get_cpu_idle_time_us_raw and get_cpu_iowait_time_us_raw, so that
/proc/stat logic can use them to get the last raw value of idle_sleeptime
and iowait_sleeptime from tick_cpu_sched without any calculation when CPU
is offline. It avoids /proc/stat idle/iowait fluctuation when cpu hotplug.
In addition, revise a comment about broken iowait counter update race
related to the topic.
Xin Zhao (2):
timers/nohz: Revise a comment about broken iowait counter update race
timers/nohz: Avoid /proc/stat idle/iowait fluctuation when cpu hotplug
fs/proc/stat.c | 4 ++++
include/linux/tick.h | 4 ++++
kernel/time/tick-sched.c | 50 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 56 insertions(+), 2 deletions(-)
--
2.34.1
Powered by blists - more mailing lists