[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aRGMzjXMkOsU-2le@gpd4>
Date: Mon, 10 Nov 2025 07:57:18 +0100
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
Dan Schatzberg <schatzberg.dan@...il.com>,
Emil Tsalapatis <etsal@...a.com>, sched-ext@...ts.linux.dev,
linux-kernel@...r.kernel.org, Patrick Lu <patlu@...a.com>
Subject: Re: [PATCH 01/13] sched_ext: Don't set ddsp_dsq_id during select_cpu
in bypass mode
Hi Tejun,
On Sun, Nov 09, 2025 at 08:31:00AM -1000, Tejun Heo wrote:
> In the default CPU selection path used during bypass mode, select_task_rq_scx()
> set p->scx.ddsp_dsq_id to SCX_DSQ_LOCAL to emulate direct dispatch. However,
> do_enqueue_task() ignores ddsp_dsq_id in bypass mode and queues to the global
> DSQ, leaving ddsp_dsq_id dangling. This triggers WARN_ON_ONCE() in
> mark_direct_dispatch() if the task later gets direct dispatched.
The patch makes sense and I was actually testing something similar to fix
https://github.com/sched-ext/scx/issues/2758.
However, in dispatch_enqueue() we're always clearing p->scx.ddsp_dsq_id
(SCX_DSQ_INVALID), even when we're targeting the global DSQ due to bypass
mode, so in this scenario we shouldn't see a stale ddsp_dsq_id. Am I
missing something?
Thanks,
-Andrea
>
> Don't use direct dispatch from bypass. Just return the selected CPU, which has
> the effect of waking up the picked idle CPU. Later patches will implement
> per-CPU bypass DSQs to resolve this issue in a more proper way.
>
> Reported-by: Patrick Lu <patlu@...a.com>
> Signed-off-by: Tejun Heo <tj@...nel.org>
> ---
> kernel/sched/ext.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 652a364e9e4c..cf8d86a2585c 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -2521,12 +2521,8 @@ static int select_task_rq_scx(struct task_struct *p, int prev_cpu, int wake_flag
> s32 cpu;
>
> cpu = scx_select_cpu_dfl(p, prev_cpu, wake_flags, NULL, 0);
> - if (cpu >= 0) {
> - refill_task_slice_dfl(sch, p);
> - p->scx.ddsp_dsq_id = SCX_DSQ_LOCAL;
> - } else {
> + if (cpu < 0)
> cpu = prev_cpu;
> - }
> p->scx.selected_cpu = cpu;
>
> if (rq_bypass)
> --
> 2.51.1
>
Powered by blists - more mailing lists