Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: Fix inconsistent NUMA node lookup in scx_select_cpu_dfl()

In the WAKE_SYNC path of scx_select_cpu_dfl(), waker_node was computed
with cpu_to_node(), while node (for prev_cpu) was computed with
scx_cpu_node_if_enabled(). When scx_builtin_idle_per_node is disabled,
idle_cpumask(waker_node) is called with a real node ID even though
per-node idle tracking is disabled, resulting in undefined behavior.

Fix by using scx_cpu_node_if_enabled() for waker_node as well, ensuring
both variables are computed consistently.

Fixes: 48849271e6611 ("sched_ext: idle: Per-node idle cpumasks")
Cc: stable@vger.kernel.org # v6.15+
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Cheng-Yang Chou and committed by
Tejun Heo
db08b194 2fcfe595

+1 -1
+1 -1
kernel/sched/ext_idle.c
··· 543 543 * piled up on it even if there is an idle core elsewhere on 544 544 * the system. 545 545 */ 546 - waker_node = cpu_to_node(cpu); 546 + waker_node = scx_cpu_node_if_enabled(cpu); 547 547 if (!(current->flags & PF_EXITING) && 548 548 cpu_rq(cpu)->scx.local_dsq.nr == 0 && 549 549 (!(flags & SCX_PICK_IDLE_IN_NODE) || (waker_node == node)) &&