summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2026-02-18 15:20:06 +0100
committerVasily Gorbik <gor@linux.ibm.com>2026-02-25 16:46:07 +0100
commitaefa6ec890f0d39a89fc80e95908ec1996337eee (patch)
tree4c4c5a405bda1fb44564d27a05b41d6f9171da76
parentdbc0fb35679ed5d0adecf7d02137ac2c77244b3b (diff)
downloadlinux-aefa6ec890f0d39a89fc80e95908ec1996337eee.tar.gz
linux-aefa6ec890f0d39a89fc80e95908ec1996337eee.zip
s390/idle: Add comment for non obvious code
Add a comment to update_timer_idle() which describes why wall time (not steal time) is added to steal_timer. This is not obvious and was reported by Frederic Weisbecker. Reported-by: Frederic Weisbecker <frederic@kernel.org> Closes: https://lore.kernel.org/all/aXEVM-04lj0lntMr@localhost.localdomain/ Reviewed-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r--arch/s390/kernel/idle.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/s390/kernel/idle.c b/arch/s390/kernel/idle.c
index 0f9e53f0a068..4e09f126d4fc 100644
--- a/arch/s390/kernel/idle.c
+++ b/arch/s390/kernel/idle.c
@@ -34,6 +34,15 @@ void update_timer_idle(void)
this_cpu_add(mt_cycles[i], cycles_new[i] - idle->mt_cycles_enter[i]);
}
+ /*
+ * This is a bit subtle: Forward last_update_clock so it excludes idle
+ * time. For correct steal time calculation in do_account_vtime() add
+ * passed wall time before idle_enter to steal_timer:
+ * During the passed wall time before idle_enter CPU time may have
+ * been accounted to system, hardirq, softirq, etc. lowcore fields.
+ * The accounted CPU times will be subtracted again from steal_timer
+ * when accumulated steal time is calculated in do_account_vtime().
+ */
lc->steal_timer += idle->clock_idle_enter - lc->last_update_clock;
lc->last_update_clock = lc->int_clock;