Re: [PATCH 1/2] sched/core: Pass ENQUEUE_RQ_SELECTED on initial enqueue
From: Peter Zijlstra
Date: Fri Nov 20 2026 - 11:21:41 EST
On Sun, Nov 15, 2026 at 05:06:35AM -1000, Tejun Heo wrote:
> On Thu, Nov 12, 2026 at 10:49:34PM +0800, Tao Cui wrote:
> > select_task_rq() sets WF_RQ_SELECTED and ttwu_do_activate() maps it to
> > ENQUEUE_RQ_SELECTED so enqueue_task_scx() knows whether ops.select_cpu()
> > ran. wake_up_new_task() also calls select_task_rq() but activates the
> > new task without the flag, so on the fork path ops.enqueue() never sees
> > SCX_ENQ_CPU_SELECTED and SCX_EV_SELECT_CPU_FALLBACK never counts a
> > fork-path fallback: a misbehaving select_cpu() leaves no trace in the
> > counters, and schedulers testing SCX_ENQ_CPU_SELECTED run a redundant
> > select_cpu_dfl() on tasks select_cpu() already placed.
> >
> > Set ENQUEUE_RQ_SELECTED on the initial enqueue when select_task_rq() was
> > called, matching the wakeup path. Only sched_ext consumes the flag.
> >
> > Fixes: 9b671793c7d9 ("sched_ext, scx_qmap: Add and use SCX_ENQ_CPU_SELECTED")
> > Signed-off-by: Tao Cui <cuitao@xxxxxxxxxx>
>
> Acked-by: Tejun Heo <tj@xxxxxxxxxx>
>
> Peter, how do you want to route this? I can take it through sched_ext too
> given that the flag is only consumed by sched_ext.
Yeah, take it through sched_ext; I don't think I've got any conflicts
around there.
Thanks!