• Daniel Bristot de Oliveira's avatar
    sched/deadline: Deferrable dl server · a110a81c
    Daniel Bristot de Oliveira authored
    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: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Tested-by: default avatarJuri Lelli <juri.lelli@redhat.com>
    Link: https://lore.kernel.org/r/dd175943c72533cd9f0b87767c6499204879cc38.1716811044.git.bristot@kernel.org
    a110a81c
sched.h 94.6 KB