Re: [PATCH] sched_ext: Invalidate dispatch decisions on CPU affinity changes

From: Kuba Piecuch

Date: Thu Feb 05 2026 - 12:24:42 EST


On Wed Feb 4, 2026 at 5:56 PM UTC, Andrea Righi wrote:
> Right. At this point I think we can just rely on the affinity validation
> via task_can_run_on_remote_rq(), where p->cpus_ptr is always stable and
> just drop invalid dispatches.
>
> And to prevent dropped tasks, I was wondering if we could just insert the
> task into a per-rq fallback DSQ, that can be consumed from balance_scx() to
> re-enqueue the task (setting SCX_ENQ_REENQ). This should solve the
> re-enqueue problem avoiding the locking complexity of calling ops.enqueue()
> directly from finish_dispatch().
>
> Thoughts?

How would these fallback DSQs work?

1. Would inserting the task into the fallback DSQ trigger ops.dequeue(), so
that we can later balance it with the re-enqueue?

2. Which rq's fallback DSQ will the task be inserted into? The one belonging to
the CPU doing the dispatch?

3. Is the re-enqueue going to happen inside the same call to balance_one() that
tried to dispatch the task?

I'm not opposed to the idea, I'm curious to see how it works in practice.

Thanks,
Kuba