[PATCH] sched_ext: idle: use active idle domain in WAKE_SYNC check

From: Joseph Salisbury

Date: Tue Mar 24 2026 - 16:03:10 EST


The WAKE_SYNC fast path checks whether there are idle CPUs before
biasing wakeups to the waker CPU. After per-node idle masks were
introduced, this path started indexing idle_cpumask() with
cpu_to_node().

When per-node idle tracking is disabled, per-node masks are not kept in
sync and may be stale. Reading them here can mis-detect system
utilization and lead to incorrect WAKE_SYNC wakeup placement.

Use scx_cpu_node_if_enabled() for the waker node lookup so this check
uses the global idle mask when per-node tracking is disabled and the
per-node mask only when that mode is enabled.

Fixes: 48849271e661 ("sched_ext: idle: Per-node idle cpumasks")
Cc: stable@xxxxxxxxxxxxxxx # v6.15+
Assisted-by: Codex:GPT-5
Signed-off-by: Joseph Salisbury <joseph.salisbury@xxxxxxxxxx>
---
kernel/sched/ext_idle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/ext_idle.c b/kernel/sched/ext_idle.c
index 8cfe0e9a7319..6b4520ed563d 100644
--- a/kernel/sched/ext_idle.c
+++ b/kernel/sched/ext_idle.c
@@ -543,7 +543,7 @@ s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
* piled up on it even if there is an idle core elsewhere on
* the system.
*/
- waker_node = cpu_to_node(cpu);
+ waker_node = scx_cpu_node_if_enabled(cpu);
if (!(current->flags & PF_EXITING) &&
cpu_rq(cpu)->scx.local_dsq.nr == 0 &&
(!(flags & SCX_PICK_IDLE_IN_NODE) || (waker_node == node)) &&
--
2.47.3