Re: [PATCH v5 6/7] sched/deadline: Deferrable dl server

From: Peter Zijlstra
Date: Wed Nov 08 2023 - 07:50:52 EST


On Wed, Nov 08, 2023 at 01:44:01PM +0100, Peter Zijlstra wrote:

> Should we rather not cap the runtime, something like so?
>

Clearly I should've done the patch against a tree that includes the
changes...

> ---
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 58b542bf2893..1453a2cd0680 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -829,10 +829,12 @@ static inline void setup_new_dl_entity(struct sched_dl_entity *dl_se)
> */
> static void replenish_dl_entity(struct sched_dl_entity *dl_se)
> {
> + struct sched_dl_entity *pi_se = pi_of(dl_se);
> struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
> struct rq *rq = rq_of_dl_rq(dl_rq);
> + u64 dl_runtime = pi_se->dl_runtime;
>
> - WARN_ON_ONCE(pi_of(dl_se)->dl_runtime <= 0);
> + WARN_ON_ONCE(dl_runtime <= 0);
>
> /*
> * This could be the case for a !-dl task that is boosted.
> @@ -851,10 +853,13 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se)
> * arbitrary large.
> */
> while (dl_se->runtime <= 0) {
> - dl_se->deadline += pi_of(dl_se)->dl_period;
> - dl_se->runtime += pi_of(dl_se)->dl_runtime;
> + dl_se->deadline += pi_se->dl_period;
> + dl_se->runtime += dl_runtime;
> }
>
> + if (dl_se->zerolax && dl_se->runtime > dl_runtime)
> + dl_se->runtime = dl_runtime;
> +

This should ofcourse go in the if (dl_se->dl_zerolax_armed) branch a
little down from here.

> /*
> * At this point, the deadline really should be "in
> * the future" with respect to rq->clock. If it's