tick/nohz: Remove redundant IRQ save/restore
PATCH 1/1 tick/nohz: Remove redundant IRQ save/restore
tick_nohz_update_jiffies() is only reached through tick_irq_enter() from hard interrupt entry, where local interrupts are already disabled.
tick_do_update_jiffies64() requires interrupts to be disabled. The local_irq_save()/local_irq_restore() pair around it therefore provides no additional interrupt exclusion.
Remove it and assert the caller invariant instead.
On x86-64, this avoids the redundant RFLAGS save, CLI, saved-IF test and conditional branch on the tick-stopped path.
On a 252-CPU host running a Thrift RPC service, tick_irq_enter() ran 165,116 times/s out of 212-244k interrupts/s. Only calls with TS_FLAG_STOPPED reach the optimized path, so this is an upper bound on its execution rate.
--- kernel/time/tick-sched.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/time/tick-sched.c +2 -5
@@ -738,14 +738,11 @@ bool tick_nohz_tick_stopped_cpu(int cpu)*/ static void tick_nohz_update_jiffies (ktime_t now) { -unsigned long flags; +/* Reached only from irq_enter_rcu(), i.e. hard interrupt entry. */ +lockdep_assert_irqs_disabled ();__this_cpu_write (tick_cpu_sched.idle_waketime, now); - -local_irq_save (flags);tick_do_update_jiffies64 (now); -local_irq_restore (flags); -touch_softlockup_watchdog_sched (); }
Signature · 1 line
2.53.0-Meta
Quoted 12 lines · Usama Arif
tick_nohz_update_jiffies()is only reached throughtick_irq_enter()from hard interrupt entry, where local interrupts are already disabled.
tick_do_update_jiffies64()requires interrupts to be disabled. The local_irq_save()/local_irq_restore() pair around it therefore provides no additional interrupt exclusion.Remove it and assert the caller invariant instead.
On x86-64, this avoids the redundant RFLAGS save, CLI, saved-IF test and conditional branch on the tick-stopped path.
Quoted 6 lines
On a 252-CPU host running a Thrift RPC service,
tick_irq_enter()ran 165,116 times/s out of 212-244k interrupts/s. Only calls withTS_FLAG_STOPPEDreach the optimized path, so this is an upper bound on its execution rate.Signed-off-by Usama Arif <[email protected]>
Signature · 2 lines
Frederic Weisbecker SUSE Labs
[tip: timers/nohz] tick/nohz: Remove redundant local_irq_save()/restore()
In reply to Usama ArifThe following commit has been merged into the timers/nohz branch of tip:
The following commit has been merged into the timers/nohz branch of tip:
Commit-ID: 75990fb534e858ac61ae7651c4695e0905a04443 Gitweb: https://git.kernel.org/tip/75990fb534e858ac61ae7651c4695e0905a04443 Author: Usama Arif <[email protected]> AuthorDate: Wed, 16 Sep 2026 07:15:30 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 29 Sep 2026 20:55:51 +02:00
tick/nohz: Remove redundant local_irq_save()/restore()
tick_nohz_update_jiffies() is only reached through tick_irq_enter() from hard interrupt entry, where local interrupts are already disabled.
tick_do_update_jiffies64() requires interrupts to be disabled. The local_irq_save()/local_irq_restore() pair around it therefore provides no additional interrupt exclusion.
Remove it and assert the caller invariant instead.
On x86-64, this avoids the redundant RFLAGS save, CLI, saved-IF test and conditional branch on the tick-stopped path.
On a 252-CPU host running a Thrift RPC service, tick_irq_enter() ran 165,116 times/s out of 212-244k interrupts/s. Only calls with TS_FLAG_STOPPED reach the optimized path, so this is an upper bound on its execution rate.
--- kernel/time/tick-sched.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/time/tick-sched.c +2 -5
@@ -738,14 +738,11 @@ bool tick_nohz_tick_stopped_cpu(int cpu)*/ static void tick_nohz_update_jiffies (ktime_t now) { -unsigned long flags; +/* Reached only from irq_enter_rcu(), i.e. hard interrupt entry. */ +lockdep_assert_irqs_disabled ();__this_cpu_write (tick_cpu_sched.idle_waketime, now); - -local_irq_save (flags);tick_do_update_jiffies64 (now); -local_irq_restore (flags); -touch_softlockup_watchdog_sched (); }