]> Gentwo Git Trees - linux/.git/commit
tick/sched: Limit non-timekeeper CPUs calling jiffies update
authorSteve Wahl <steve.wahl@hpe.com>
Mon, 27 Oct 2025 18:34:56 +0000 (13:34 -0500)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 1 Nov 2025 19:25:53 +0000 (20:25 +0100)
commit4138787408aa47e9e107f28876cb59b42d78bb99
tree7bb3190683c9d08b1703605da5a02aa0850eddf7
parent391253b25f078d2fe5657a1dedd360396d186407
tick/sched: Limit non-timekeeper CPUs calling jiffies update

On large NUMA systems, while running a test program that saturates the
inter-processor and inter-NUMA links, acquiring the jiffies_lock can be
very expensive.

If the cpu designated to do jiffies updates (tick_do_timer_cpu) gets
delayed and other cpus decide to do the jiffies update themselves, a large
number of them decide to do so at the same time.

The inexpensive check against tick_next_period is far quicker than actually
acquiring the lock, so most of these get in line to obtain the lock.  If
obtaining the lock is slow enough, this spirals into the vast majority of
CPUs continuously being stuck waiting for this lock, just to obtain it and
find out that time has already been updated by another cpu. For example, on
one random entry to kdb by manually-injected NMI, 2912 of 3840 CPUs were
observed to be stuck there.

To avoid this, allow only one non-timekeeper CPU to call
tick_do_update_jiffies64() at any given time, resetting ts->stalled jiffies
only if the jiffies update function is actually called.

With this change, manually interrupting the test at most two CPUs are
observed to invoke tick_do_update_jiffies64() - the timekeeper and one
other.

Signed-off-by: Steve Wahl <steve.wahl@hpe.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Link: https://patch.msgid.link/20251027183456.343407-1-steve.wahl@hpe.com
kernel/time/tick-sched.c