[PATCH 04/17] srcu: Check only the boot CPU callback queue in SMALL domains

From: Kunwu Chan

Date: Tue Dec 01 2026 - 11:19:59 EST


SMALL domains route callbacks through the boot CPU. Check only that
queue before attempting a caller-driven expedited GP.

In three earlier paired idle SMALL runs on 192-vCPU arm64 KVM, p50
fell from 15.25-15.26 to 14.26-14.30 us versus the all-CPU check.

Signed-off-by: Kunwu Chan <kunwu.chan@xxxxxxxxx>
---
kernel/rcu/srcutree.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index d7773825e814..1588973432cb 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -1721,6 +1721,7 @@ static bool srcu_expedited_fastpath(struct srcu_struct *ssp)
unsigned long cookie, flags;
int cpu;
int ss_state;
+ struct srcu_data *sdp;
struct srcu_usage *sup = ssp->srcu_sup;

if (!srcu_init_done || rcu_scheduler_active != RCU_SCHEDULER_RUNNING ||
@@ -1728,9 +1729,18 @@ static bool srcu_expedited_fastpath(struct srcu_struct *ssp)
return false;

/* Pending callbacks are a hint to use the worker. */
- for_each_possible_cpu(cpu)
- if (rcu_segcblist_n_cbs(&per_cpu_ptr(ssp->sda, cpu)->srcu_cblist))
+ if (READ_ONCE(sup->srcu_size_state) == SRCU_SIZE_SMALL) {
+ /* SMALL uses the boot CPU in srcu_gp_start_if_needed(). */
+ sdp = per_cpu_ptr(ssp->sda, get_boot_cpu_id());
+ if (rcu_segcblist_n_cbs(&sdp->srcu_cblist))
return false;
+ } else {
+ for_each_possible_cpu(cpu) {
+ sdp = per_cpu_ptr(ssp->sda, cpu);
+ if (rcu_segcblist_n_cbs(&sdp->srcu_cblist))
+ return false;
+ }
+ }

/* Reader hint. Ordered scans follow GP start. */
if (srcu_readers_active(ssp))
--
2.43.0