Re: [PATCH 5/6] sched_ext: Add a kfunc to read a task's preferred NUMA node

From: Peter Zijlstra

Date: Tue Oct 27 2026 - 08:02:22 EST


On Tue, Oct 27, 2026 at 12:21:01PM +0100, Andrea Righi wrote:

> > But should we not cleanup first and then add shiny on top?
>
> Fair enough. Looking more closely, I think there're only two places in
> fair that still use p->numa_preferred_nid when NUMA balancing is
> disabled at runtime: find_idlest_group() and the fbq classification in
> the load balancer (via rq->nr_numa_running / nr_preferred_running).
> Everything else is already gated by sched_numa_balancing.
>
> Assuming I'm not missing anything, we can probably add a preparatory
> patch that gates those two on sched_numa_balancing as well, then make
> scx_bpf_task_numa_nid() return NUMA_NO_NODE when NUMA balancing is
> disabled. In this way the stale value is never used.

Sounds like a plan :-)