freenode
Kernel & Low-Level

Linux proxy execution series adds sleeping-owner handling

John Stultz posts the next major stage of scheduler proxy execution, covering waiters blocked on mutexes whose owners are asleep.

John Stultz has posted the latest iteration of Linux kernel proxy execution work, focused on sleeping-owner handling: what the scheduler should do when a task blocks on a mutex whose owner is itself asleep.

Proxy execution lets a blocked waiter donate scheduling context so the lock owner can run and release the lock, easing priority inversion and related stalls. When the owner is sleeping, there is no runnable task left to boost. The new path deactivates the waiter and enqueues it on a list attached to that owner. Once the owner wakes, the waiters are reactivated on the same runqueue and can then boost it.

That behavior is harder than it sounds. Waiters can form trees, tasks in the middle of a chain can wake on their own, and cascading activations need careful list handling without deep recursion. The series also brings early cycle detection so a circular blocked-on chain cannot leave the scheduler looping while holding a runqueue lock, and it corrects pressure-stall information (PSI) accounting when proxy execution performs sleeping dequeues that are not followed by a normal task switch.

Stultz continues to land the larger design in stages. Sleeping-owner handling follows single-runqueue proxying and donor migration, and precedes core-scheduling fixes, chain-level balancing, and proxy support for reader-writer semaphores and futexes. An alternative design from K Prateek Nayak was discussed with Peter Zijlstra at LPC; the plan is to ship this comparatively simpler approach first and revisit the optimization later.

Reviewers are still pressing on activation races, PSI edge cases around delayed dequeues and workqueue workers, and whether some return paths skip core-scheduling cookie checks. Zijlstra, who originated much of the sleeping-owner logic, has also flagged awkward locking and asked for ways to simplify it.