Skip to content

Commit aefa6ec

Browse files
hcahcaVasily Gorbik
authored andcommitted
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>
1 parent dbc0fb3 commit aefa6ec

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

arch/s390/kernel/idle.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ void update_timer_idle(void)
3434
this_cpu_add(mt_cycles[i], cycles_new[i] - idle->mt_cycles_enter[i]);
3535
}
3636

37+
/*
38+
* This is a bit subtle: Forward last_update_clock so it excludes idle
39+
* time. For correct steal time calculation in do_account_vtime() add
40+
* passed wall time before idle_enter to steal_timer:
41+
* During the passed wall time before idle_enter CPU time may have
42+
* been accounted to system, hardirq, softirq, etc. lowcore fields.
43+
* The accounted CPU times will be subtracted again from steal_timer
44+
* when accumulated steal time is calculated in do_account_vtime().
45+
*/
3746
lc->steal_timer += idle->clock_idle_enter - lc->last_update_clock;
3847
lc->last_update_clock = lc->int_clock;
3948

0 commit comments

Comments
 (0)