Skip to content

Commit a110a81

Browse files
Daniel Bristot de OliveiraPeter Zijlstra
authored andcommitted
sched/deadline: Deferrable dl server
Among the motivations for the DL servers is the real-time throttling mechanism. This mechanism works by throttling the rt_rq after running for a long period without leaving space for fair tasks. The base dl server avoids this problem by boosting fair tasks instead of throttling the rt_rq. The point is that it boosts without waiting for potential starvation, causing some non-intuitive cases. For example, an IRQ dispatches two tasks on an idle system, a fair and an RT. The DL server will be activated, running the fair task before the RT one. This problem can be avoided by deferring the dl server activation. By setting the defer option, the dl_server will dispatch an SCHED_DEADLINE reservation with replenished runtime, but throttled. The dl_timer will be set for the defer time at (period - runtime) ns from start time. Thus boosting the fair rq at defer time. If the fair scheduler has the opportunity to run while waiting for defer time, the dl server runtime will be consumed. If the runtime is completely consumed before the defer time, the server will be replenished while still in a throttled state. Then, the dl_timer will be reset to the new defer time If the fair server reaches the defer time without consuming its runtime, the server will start running, following CBS rules (thus without breaking SCHED_DEADLINE). Then the server will continue the running state (without deferring) until it fair tasks are able to execute as regular fair scheduler (end of the starvation). Signed-off-by: Daniel Bristot de Oliveira <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Juri Lelli <[email protected]> Link: https://lore.kernel.org/r/dd175943c72533cd9f0b87767c6499204879cc38.1716811044.git.bristot@kernel.org
1 parent 557a6bf commit a110a81

File tree

5 files changed

+298
-45
lines changed

5 files changed

+298
-45
lines changed

include/linux/sched.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,24 @@ struct sched_dl_entity {
641641
* overruns.
642642
*
643643
* @dl_server tells if this is a server entity.
644+
*
645+
* @dl_defer tells if this is a deferred or regular server. For
646+
* now only defer server exists.
647+
*
648+
* @dl_defer_armed tells if the deferrable server is waiting
649+
* for the replenishment timer to activate it.
650+
*
651+
* @dl_defer_running tells if the deferrable server is actually
652+
* running, skipping the defer phase.
644653
*/
645654
unsigned int dl_throttled : 1;
646655
unsigned int dl_yielded : 1;
647656
unsigned int dl_non_contending : 1;
648657
unsigned int dl_overrun : 1;
649658
unsigned int dl_server : 1;
659+
unsigned int dl_defer : 1;
660+
unsigned int dl_defer_armed : 1;
661+
unsigned int dl_defer_running : 1;
650662

651663
/*
652664
* Bandwidth enforcement timer. Each -deadline task has its

0 commit comments

Comments
 (0)