Re: [PATCHSET sched_ext/for-7.1] sched_ext: Overhaul DSQ reenqueue infrastructure
From: Andrea Righi
Date: Fri Mar 06 2026 - 18:15:07 EST
On Fri, Mar 06, 2026 at 09:06:08AM -1000, Tejun Heo wrote:
> scx_bpf_reenqueue_local() currently only supports the current CPU's local
> DSQ and must be called from ops.cpu_release(). This patchset overhauls the
> reenqueue infrastructure to support flexible, remote, and user DSQ reenqueue
> operations through the new scx_bpf_dsq_reenq() kfunc.
>
> The patchset:
>
> - Refactors per-node data structures and DSQ lookup helpers as preparation.
>
> - Converts the deferred reenqueue mechanism from lockless llist to a
> spinlock-protected regular list to support more complex list operations.
>
> - Introduces scx_bpf_dsq_reenq() which can target any local DSQ including
> remote CPUs via SCX_DSQ_LOCAL_ON | cpu, and user-defined DSQs.
>
> - Adds per-CPU data to DSQs and cursor-based iteration helpers to support
> user DSQ reenqueue with proper multi-rq locking.
>
> - Adds reenqueue flags plumbing and a lockless fast-path optimization.
>
> - Simplifies task state handling and adds SCX_TASK_REENQ_REASON flags so BPF
> schedulers can distinguish why a task is being reenqueued.
>
> scx_bpf_reenqueue_local() is reimplemented as a wrapper around
> scx_bpf_dsq_reenq(SCX_DSQ_LOCAL, 0) and may be deprecated in the future.
This is really useful! Small issue on patch 10/15 (that you've already
fixed). Everything else looks good to me.
Reviewed-by: Andrea Righi <arighi@xxxxxxxxxx>
Thanks.
-Andrea