* [PATCH] sched_ext: idle: use active idle domain in WAKE_SYNC check
@ 2026-03-24 19:58 Joseph Salisbury
2026-03-25 23:24 ` Andrea Righi
0 siblings, 1 reply; 3+ messages in thread
From: Joseph Salisbury @ 2026-03-24 19:58 UTC (permalink / raw)
To: Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, sched-ext, linux-kernel
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@vger.kernel.org # v6.15+
Assisted-by: Codex:GPT-5
Signed-off-by: Joseph Salisbury <joseph.salisbury@oracle.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sched_ext: idle: use active idle domain in WAKE_SYNC check
2026-03-24 19:58 [PATCH] sched_ext: idle: use active idle domain in WAKE_SYNC check Joseph Salisbury
@ 2026-03-25 23:24 ` Andrea Righi
2026-03-26 18:19 ` [External] : " Joseph Salisbury
0 siblings, 1 reply; 3+ messages in thread
From: Andrea Righi @ 2026-03-25 23:24 UTC (permalink / raw)
To: Joseph Salisbury
Cc: Tejun Heo, David Vernet, Changwoo Min, Ingo Molnar,
Peter Zijlstra, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
sched-ext, linux-kernel
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@vger.kernel.org # v6.15+
> Assisted-by: Codex:GPT-5
> Signed-off-by: Joseph Salisbury <joseph.salisbury@oracle.com>
This is good, but it's already fixed:
https://lore.kernel.org/all/20260321105503.869337-1-yphbchou0911@gmail.com
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,
-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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [External] : Re: [PATCH] sched_ext: idle: use active idle domain in WAKE_SYNC check
2026-03-25 23:24 ` Andrea Righi
@ 2026-03-26 18:19 ` Joseph Salisbury
0 siblings, 0 replies; 3+ messages in thread
From: Joseph Salisbury @ 2026-03-26 18:19 UTC (permalink / raw)
To: Andrea Righi
Cc: Tejun Heo, David Vernet, Changwoo Min, Ingo Molnar,
Peter Zijlstra, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
sched-ext, linux-kernel
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@vger.kernel.org # v6.15+
>> Assisted-by: Codex:GPT-5
>> Signed-off-by: Joseph Salisbury <joseph.salisbury@oracle.com>
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-26 18:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 19:58 [PATCH] sched_ext: idle: use active idle domain in WAKE_SYNC check Joseph Salisbury
2026-03-25 23:24 ` Andrea Righi
2026-03-26 18:19 ` [External] : " Joseph Salisbury
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox