[PATCH 2/2] sched: use static_branch_likely() for the NUMA balancing tick check
From: Yafang Shao
Date: Thu Oct 22 2026 - 22:32:03 EST
task_tick_fair() checks sched_numa_balancing on every tick. The
static_branch_unlikely() annotation reserves the nop for the disabled case,
so the default configuration (NUMA_BALANCING_DEFAULT_ENABLED=y) pays a
taken jump per tick. Flip the polarity to static_branch_likely() so that
the fast path matches the default.
Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
Acked-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 973647ad6c2d..71dc47d6114d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -15351,7 +15351,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
if (queued)
return;
- if (static_branch_unlikely(&sched_numa_balancing))
+ if (static_branch_likely(&sched_numa_balancing))
task_tick_numa(rq, curr);
task_tick_cache(rq, curr);
--
2.52.0