]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched/deadline: Fix dl_server stop condition
authorPeter Zijlstra <peterz@infradead.org>
Fri, 31 Oct 2025 12:54:24 +0000 (13:54 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 11 Nov 2025 11:33:39 +0000 (12:33 +0100)
commitf5a538c07df26f5c601e41f7b9c7ade3e1e75803
treea88bc936dc916e64613a9537a9f9c01954e24c12
parente636ffb9e31b4f7dde7fef5358669266b9ce02ec
sched/deadline: Fix dl_server stop condition

Gabriel reported that the dl_server doesn't stop as expected.

The problem was found to be the fact that idle time and fair runtime are
treated equally. Both will count towards dl_server runtime and push the
activation forwards when it is in the zero-laxity wait state.

Notably:

  dl_server_update_idle()
    update_curr_dl_se()
      if (dl_defer && dl_throttled && dl_runtime_exceeded())
        hrtimer_try_to_cancel(); // stop timer
replenish_dl_new_period()
  deadline = now + dl_deadline; // fwd period
  runtime = dl_runtime;
        start_dl_timer(); // restart timer

And while we do want idle time accounted towards the *current* activation of
the dl_server -- after all, a fair task could've ran if we had any -- we don't
necessarily want idle time to cause or push forward an activation.

Introduce dl_defer_idle to make this distinction. It will be set once idle time
pushed the activation forward, once set idle time will only be allowed to
consume any runtime but not push the activation. This will then cause
dl_server_timer() to fire, which will stop the dl_server.

Any non-idle time accounting during this phase will clear dl_defer_idle, so
only a full period of idle will cause the dl_server to stop.

Reported-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251101000057.GA2184199@noisy.programming.kicks-ass.net
include/linux/sched.h
kernel/sched/deadline.c