Re: [PATCHSET sched_ext/for-7.3-fixes] sched_ext: Fix missing ops.dequeue() on remote local DSQ moves
From: Andrea Righi
Date: Tue Sep 29 2026 - 14:30:52 EST
On Tue, Sep 29, 2026 at 07:13:07AM -1000, Tejun Heo wrote:
> Hello,
>
> On Tue, Sep 29, 2026 at 04:17:23PM +0000, Kuba Piecuch wrote:
> > Since ebf1ccff79c4 ("sched_ext: Fix ops.dequeue() semantics"), every task
> > entering the BPF scheduler's custody gets exactly one ops.dequeue() when
> > it leaves it. A dispatch to a terminal DSQ ends custody with a flag-less
> > ops.dequeue() at insertion time.
>
> The fix looks good to me. It effectively reverts the enqueue_task_scx()
> half of b75aaea24c9f ("sched_ext: Properly mark SCX-internal migrations
> via sticky_cpu"), which as far as I can see only ever suppressed this
> ops.dequeue(). Andrea, can you confirm?
Yes, I confirm. The source-side sticky_cpu assignment remains in place across
deactivate_task(), so the internal migration doesn't trigger ops.dequeue().
Kuba, thanks for catching this!
>
> - dequeue_remote.c isn't built until 3/3, so 1/3 can't be built or run.
> Can you put the fix first, followed by the test with its Makefile entry?
>
> - 2/3: 7.1.y also needs 18d62044cda7 ("sched_ext: Preserve rq tracking
> across local DSQ dispatch"). Without it, the nested ops.dequeue() trips
> lockdep when ops.dispatch() uses scx_bpf_dsq_move() to another CPU's
> local DSQ. It's tagged for stable too, but maybe note it as a
> prerequisite?
Agreed. Please mention 18d62044cda7 as a prerequisite for 7.1.y.
Thanks,
-Andrea
>
> - 2/3: With sub-scheds, scx_resolve_local_dsq() can divert the task to the
> reject or rescue DSQ, so "inserted into the local DSQ" in the comments
> isn't always accurate. Maybe "destination DSQ"? The new comment in
> enqueue_task_scx() could be two lines, and the description could lead
> with the late SCX_DEQ_CORE_SCHED_EXEC and be a lot shorter.
>
> - 1/3: A task can only be picked straight out of custody through
> sched_core_find(), which only returns tasks with a core cookie. Checking
> p->core_cookie on SCX_DEQ_CORE_SCHED_EXEC would be exact and would
> remove core_sched_in_use() and the skip.
>
> - 1/3: _SC_NPROCESSORS_ONLN ignores affinity. With the runner confined to
> one CPU, the test fails instead of skipping. sched_getaffinity() and
> CPU_COUNT()?
>
> - 1/3: Nits. If the /proc scan stays, PR_SCHED_CORE_GET writes a u64, so
> the cookie should be u64. ops.dispatch() pops one entry per call, so a
> stale one idles the CPU until the next kick. Maybe loop a few times?
> missed_dequeue_cnt and core_sched_exec_dequeue_cnt aren't printed
> per-scenario like the other counters.
>
> - 1/3: The variants, error conditions and core-sched caveat are repeated
> across the cover, description, file header and comments. Can you say
> each once? Also, single-line comments are usually lowercase in
> sched_ext.
>
> Thanks.
>
> --
> tejun
>