freenode
Kernel & Low-Level

Linux patchset unites proxy execution with sched_ext

Distributions can ship one kernel with both features and let BPF schedulers opt in at runtime.

Andrea Righi has posted a tenth revision of a Linux scheduler patch series that lifts the build-time ban between proxy execution and sched_ext, so a single kernel can offer both and leave the choice to runtime policy.

Proxy execution lets a task blocked on a mutex donate its scheduling context to the lock owner. The owner then runs with the donor's priority and runtime budget while the donor stays eligible on the runqueue, which helps unwind priority inversions without full priority inheritance. sched_ext is the BPF extensible scheduler class: user-supplied programs decide dispatch order through their own queues and callbacks.

Until now the two could not be enabled together. A proxy handoff can put a task on the CPU that the BPF side never dispatched. sched_ext's view of "who is running," its dispatch-queue state, and helpers that assume their chosen task is current then disagree with what the core is actually executing. Distributions that want one kernel image and runtime feature selection hit that wall.

Righi's series, building on earlier work by John Stultz, makes support optional per BPF scheduler. A scheduler that sets the SCX_OPS_ENQ_BLOCKED flag keeps mutex-blocked donors runnable and receives them through its enqueue path with a blocked marker, so BPF controls whether, where, and in what order each donor is admitted. The core then walks the owner chain and, when needed, migrates the donor's scheduling context before the owner runs. Schedulers that omit the flag continue to block EXT donors the ordinary way.

The preparatory work fixes tick and bandwidth accounting so a retained fair-class donor is still charged correctly, adds hooks so sched_ext can observe donor start and proxy resolution, tightens running-session tracking across donor migrations, and parks tasks on a reject queue when a remote dispatch races with an in-flight proxy. Selftests and a demo option in scx_qmap exercise same-CPU and cross-CPU priority inversions with the new admission path.

The practical result is that vendors and operators no longer face an either-or Kconfig choice. A shipping kernel can compile both features; only BPF schedulers that explicitly opt in participate in proxy handoffs, and everyone else keeps the previous, simpler blocking behavior.