]> git.ipfire.org Git - thirdparty/linux.git/commit
timers: Get this_cpu once while clearing the idle state
authorShrikanth Hegde <sshegde@linux.ibm.com>
Mon, 23 Mar 2026 19:36:30 +0000 (01:06 +0530)
committerThomas Gleixner <tglx@kernel.org>
Tue, 24 Mar 2026 22:21:30 +0000 (23:21 +0100)
commit551e49beb1752387aed09eb2a0ea4c82ed1f3a35
tree44d8792e4cec11f5a6517301bff30505ab0c3d1a
parentf6472b17933f9adb825e7c7da31f7b7b2edb1950
timers: Get this_cpu once while clearing the idle state

Calling smp_processor_id() on:
- In CONFIG_DEBUG_PREEMPT=y, if preemption/irq is disabled, then it does
not print any warning.
- In CONFIG_DEBUG_PREEMPT=n, it doesn't do anything apart from getting
__smp_processor_id

So with both CONFIG_DEBUG_PREEMPT=y/n, in preemption disabled section it is
better to cache the value. It saves a few cycles. Though tiny, repeated
adds up.

timer_clear_idle() is called with interrupts disabled. So cache the value
once.

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
Link: https://patch.msgid.link/20260323193630.640311-5-sshegde@linux.ibm.com
kernel/time/timer.c