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

From: Joseph Salisbury

Date: Thu Mar 26 2026 - 14:35:17 EST




On 3/25/26 7:24 PM, Andrea Righi wrote:
Hi Joe,

On Tue, Mar 24, 2026 at 03:58:36PM -0400, Joseph Salisbury wrote:
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>
This is good, but it's already fixed:
https://urldefense.com/v3/__https://lore.kernel.org/all/20260321105503.869337-1-yphbchou0911@gmail.com__;!!ACWV5N9M2RV99hQ!M88Tr7SYG3FHedTvBFVj_5kAPCVI-WVHWNdHhvaysPHoUD3qbj9bZ8kNj8TwcjHXNvVTnhx0BvGh7pM5R6fC$

You can probably use Tejun's branch to search for new issues/bugs:

git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git
Thanks for the pointer!  I'll review this branch prior to sending/fixing any more bugs.

Thanks,
-Andrea

---
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