Re: [PATCHSET sched_ext/for-7.5] sched_ext: Start ext_server from the tick

From: Peter Zijlstra

Date: Wed Nov 25 2026 - 08:57:36 EST


On Wed, Nov 25, 2026 at 12:34:18AM -1000, Tejun Heo wrote:
> Hello,
>
> ext_server starts when the first task is enqueued on a CPU's rq and stops
> when its pick finds no task. As the BPF scheduler can run a task on any CPU
> whichever rq it is queued on, tasks can wait for a CPU whose ext_server has
> stopped with no enqueue to start it again, and a higher class task which
> keeps the CPU starves them until the watchdog fires. scx_central with a
> SCHED_FIFO task spinning on a CPU shows it.
>
> Peter pointed out the problem when ext_server was being added [1]. Hang's
> recent patch which starts ext_server on every enqueue [2] helps but leaves
> cases like the above.
>
> This patchset also starts ext_server from the tick, while a higher class
> task is running on the CPU:
>
> - If the local DSQ has a task, right away. This covers a task which another
> CPU inserts after the pick came up empty.
>
> - Otherwise, if any task is runnable on SCX, at most once a server period.
> Only ops.dispatch() can tell whether the BPF scheduler has a task for the
> CPU, and the server's pick calls it.
>
> Whether any task is runnable comes from per-node counts of rqs which have
> tasks, which a per-node timer lowers lazily, and a global count of such
> nodes, which is all the tick reads.
>
> This is a departure from how dl servers are usually driven and there may be
> better ways to go about it, but it does seem to solve the problem properly
> without adding much overhead.

This is all pretty awful; at the same time I don't really know if I
have a better solution at hand either :(

Could you perhaps punt the responsibility to the DSQ? Each DSQ has both:

- a count of how many tasks it has
- a sense of what CPUs it targets

Right? So can it make sure nr_tasks CPUs of its destination are running
ext_server?

That might avoid all this extra accounting and timers you're adding just
to keep stuff 'running.