Commit aefa6ec8 authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik
Browse files

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: default avatarFrederic Weisbecker <frederic@kernel.org>
Closes: https://lore.kernel.org/all/aXEVM-04lj0lntMr@localhost.localdomain/


Reviewed-by: default avatarSven Schnelle <svens@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent dbc0fb35
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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;