The Linux kernel’s extensible scheduler class “sched_ext” to allow for custom CPU scheduling policies as BPF programs continues enabling new functionality. Queued up in the sched_ext development code ahead of next month’s Linux 7.1 cycle is the new SCX_ENQ_IMMED capability for enabling tighter control over when tasks land on a CPU.
The new SCX_ENQ_IMMED flag for sched_ext controls task enqueue behavior by ensuring that a task is enqueued to a local Dispatch Queue (DSQ) if it’s able to start running immediately. In other words, if it can be executed immediately.
Longtime Linux developer Tejun Heo worked on this SCX_ENQ_IMMED flag for sched_ext and explained in the patch:
“Add SCX_ENQ_IMMED enqueue flag for local DSQ insertions. Once a task is dispatched with IMMED, it either gets on the CPU immediately and stays on it, or gets reenqueued back to the BPF scheduler. It will never linger on a local DSQ behind other tasks or on a CPU taken by a higher-priority class.
…
This enables tighter scheduling latency control by preventing tasks from piling up on local DSQs. It also enables opportunistic CPU sharing across sub-schedulers – without this, a sub-scheduler can stuff the local DSQ of a shared CPU, making it difficult for others to use.”
With the patch now part of sched_ext’s “for-7.1” Git branch, you can expect to see SCX_ENQ_IMMED submitted as part of next month’s Linux 7.1 merge window.
