Tvrtko Ursulin of Igalia has been pursuing the Fair DRM Scheduler as a “fair” scheduling policy to help with multiple applications/processes aiming to the GPU concurrently. With this week’s v4 patch-set to the DRM Fair Scheduler there are some big code changes but overall looking well as a nice scheduling policy for multiple apps/games/processes wanting equal access to GPU resources.
The Fair DRM Scheduler is inspired by the Linux kernel’s CFS scheduler. Ursulin describes this scheduling policy as:
“Fair scheduling policy is built upon the same concepts as the well known CFS kernel scheduler – entity run queue is sorted by the virtual GPU time consumed by entities in a way that the entity with least vruntime runs first.
It is able to avoid total priority starvation, which is one of the problems with FIFO, and it also eliminates the need for per priority run queues. As it scales the actual GPU runtime by an exponential factor as the priority decreases, therefore the virtual runtime for low priority entities grows faster than for normal priority, pushing them further down the runqueue order for the same real GPU time spent.
Apart from this fundamental fairness, fair policy is especially strong in oversubscription workloads where it is able to give more GPU time to short and bursty workloads when they are running in parallel with GPU heavy clients submitting deep job queues.”
Testing of the Fair DRM Scheduler in part has been focused on the Valve Steam Deck handheld with this effort by consulting firm Igalia.
As for the impact and on how it’s looking in actual use, the Igalia engineer describes the Fair DRM Scheduler v4 impact as:
“In my experiments the fair scheduler looks solid so lets see how it fares after wider testing.
On the high level main advantages of the series are:
1. Scheduling quality – schedules better than FIFO.
2. Code simplification – no more multiple run queues.
…As a headline result I have tested three simultaneous clients on the Steam Deck:
One instance of a deferredmultisampling Vulkan demo running with low priority,
one normal priority instance of the same demo, and the Unigine Heaven benchmark.With the FIFO scheduler we can see that the low priority client is completely
starved and the GPU time distribution between the other two clients is uneven:https://people.igalia.com/tursulin/drm-sched-fair/fifo-starvation.png
Switching to the fair scheduler, GPU time distribution is almost equal and the
low priority client does get a small share of the GPU:https://people.igalia.com/tursulin/drm-sched-fair/fair-no-starvation.png
…
On the overall fair looks like a potential improvement in terms of fairness, especially avoiding priority starvation. There do not appear to be any regressions with the tested workloads.”
The v4 patches replaced deadline scheduling with fair, improved the unit testing, and other improvements/fixes. More details on the Fair DRM Scheduler via this patch series.