Task migration during wakeup may cause /proc/stat iowait regression, as mentioned in the commit message of Frederic Weisbecker's previous patch. The nr_iowait statistic of rq can be decreased by remote CPU during wakeup, leading to a sudden drop in /proc/stat iowait calculation, while /proc/stat idle statistic experiences a sudden increase. Excluding the hotplug scenario when /proc/stat idle statistic may experiences a sudden decrease which is fixed in a subsequent patch, /proc/stat idle statistic will never decrease suddenly, as there is no logic in kernel that allows a remote CPU to increase rq nr_iowait. Signed-off-by: Xin Zhao --- kernel/time/tick-sched.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 8ddf74e70..4d089b290 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -812,8 +812,8 @@ static u64 get_cpu_sleep_time_us(struct tick_sched *ts, ktime_t *sleeptime, * Return the cumulative idle time (since boot) for a given * CPU, in microseconds. Note that this is partially broken due to * the counter of iowait tasks that can be remotely updated without - * any synchronization. Therefore it is possible to observe backward - * values within two consecutive reads. + * any synchronization. Therefore it is possible to observe sudden + * increases within two consecutive reads. * * This time is measured via accounting rather than sampling, * and is as accurate as ktime_get() is. -- 2.34.1