]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched/fair: Drop redundant RCU read lock in NOHZ kick path
authorAndrea Righi <arighi@nvidia.com>
Sat, 9 May 2026 18:07:25 +0000 (20:07 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 19 May 2026 10:17:37 +0000 (12:17 +0200)
commitc9d93a73ce871ca32caf9308562501290b64b955
treecece9587f57d947ded0512749575975ab92a4f91
parentacbdbab75ff4b1b87ab3c3d2b6ca86948f472189
sched/fair: Drop redundant RCU read lock in NOHZ kick path

nohz_balancer_kick() is reached from sched_balance_trigger(), which is
called from sched_tick(). sched_tick() runs with IRQs disabled, so the
additional rcu_read_lock/unlock() used around sched_domain accesses in
this path is redundant. Rely on the existing IRQ-disabled context (and
the rcu_dereference_all() checking) instead.

The same applies to set_cpu_sd_state_idle(), called from the idle entry
path with IRQs disabled, and to set_cpu_sd_state_busy(), reachable via
nohz_balance_exit_idle() from two contexts: nohz_balancer_kick() (IRQs
disabled, as above) and sched_cpu_deactivate() (the CPUHP_AP_ACTIVE
teardown, which runs under cpus_write_lock(), so it cannot race with
sched-domain rebuilds). In both cases the rcu_dereference_all()
validation is sufficient.

No functional change intended.

Suggested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://patch.msgid.link/20260509180955.1840064-2-arighi@nvidia.com
kernel/sched/fair.c