s390/vtime: Use __this_cpu_read() / get rid of READ_ONCE()

do_account_vtime() runs always with interrupts disabled, therefore use
__this_cpu_read() instead of this_cpu_read() to get rid of a pointless
preempt_disable() / preempt_enable() pair.

Also there are no concurrent writers to the cpu time accounting fields
in lowcore. Therefore get rid of READ_ONCE() usages.

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>
This commit is contained in:
Heiko Carstens
2026-02-18 15:20:10 +01:00
committed by Vasily Gorbik
parent d8b5cf9c63
commit e282ccd308

View File

@@ -137,23 +137,16 @@ static int do_account_vtime(struct task_struct *tsk)
lc->system_timer += timer;
/* Update MT utilization calculation */
if (smp_cpu_mtid &&
time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
if (smp_cpu_mtid && time_after64(jiffies_64, __this_cpu_read(mt_scaling_jiffies)))
update_mt_scaling();
/* Calculate cputime delta */
user = update_tsk_timer(&tsk->thread.user_timer,
READ_ONCE(lc->user_timer));
guest = update_tsk_timer(&tsk->thread.guest_timer,
READ_ONCE(lc->guest_timer));
system = update_tsk_timer(&tsk->thread.system_timer,
READ_ONCE(lc->system_timer));
hardirq = update_tsk_timer(&tsk->thread.hardirq_timer,
READ_ONCE(lc->hardirq_timer));
softirq = update_tsk_timer(&tsk->thread.softirq_timer,
READ_ONCE(lc->softirq_timer));
lc->steal_timer +=
clock - user - guest - system - hardirq - softirq;
user = update_tsk_timer(&tsk->thread.user_timer, lc->user_timer);
guest = update_tsk_timer(&tsk->thread.guest_timer, lc->guest_timer);
system = update_tsk_timer(&tsk->thread.system_timer, lc->system_timer);
hardirq = update_tsk_timer(&tsk->thread.hardirq_timer, lc->hardirq_timer);
softirq = update_tsk_timer(&tsk->thread.softirq_timer, lc->softirq_timer);
lc->steal_timer += clock - user - guest - system - hardirq - softirq;
/* Push account value */
if (user) {