]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
s390/idle: Slightly optimize idle time accounting
authorHeiko Carstens <hca@linux.ibm.com>
Wed, 18 Feb 2026 14:20:07 +0000 (15:20 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 25 Feb 2026 15:46:07 +0000 (16:46 +0100)
commit00d8b035eb71262abb547d47717b19f4a55ad4f2
treeba9680c35c31e76d80be2011ddad21322dc87716
parentaefa6ec890f0d39a89fc80e95908ec1996337eee
s390/idle: Slightly optimize idle time accounting

Slightly optimize account_idle_time_irq() and update_timer_idle():

- Use fast single instruction __atomic64() primitives to update per
  cpu idle_time and idle_count, instead of READ_ONCE() / WRITE_ONCE()
  pairs

- stcctm() is an inline assembly with a full memory barrier. This
  leads to a not necessary extra dereference of smp_cpu_mtid in
  update_timer_idle(). Avoid this and read smp_cpu_mtid into a
  variable

- Use __this_cpu_add() instead of this_cpu_add() to avoid disabling /
  enabling of preemption several times in a loop in update_timer_idle().

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>
arch/s390/kernel/idle.c