Re: [PATCH v4 1/2] sched/deadline: Fix bandwidth reclaim equation in GRUB

From: luca abeni
Date: Fri May 26 2023 - 11:30:11 EST


Hi,

I think the code changes look good. I only see a small issue in the
comments.

On Fri, 26 May 2023 10:55:18 -0400
Vineeth Pillai <vineeth@xxxxxxxxxxxxxxx> wrote:

> According to the GRUB[1] rule, the runtime is depreciated as:
> "dq = -max{u, (1 - Uinact - Uextra)} dt" (1)
>
> To guarantee that deadline tasks doesn't starve lower class tasks,
> we do not allocate the full bandwidth of the cpu to deadline tasks.
> Maximum bandwidth usable by deadline tasks is denoted by "Umax".
> Considering Umax, equation (1) becomes:
> "dq = -(max{u, (Umax - Uinact - Uextra)} / Umax) dt" (2)

This is correct...

[...]
> /*
> - * This function implements the GRUB accounting rule:
> - * according to the GRUB reclaiming algorithm, the runtime is
> - * not decreased as "dq = -dt", but as
> - * "dq = -max{u / Umax, (1 - Uinact - Uextra)} dt",
> + * This function implements the GRUB accounting rule. According to
> the
> + * GRUB reclaiming algorithm, the runtime is not decreased as "dq =
> -dt",
> + * but as "dq = -(max{u, (1 - Uinact - Uextra)} / Umax) dt",

...But I think this is wrong (should be "Umax - ...", not "1 - ...").
I think patch 2/2 has the same issue.

[...]
> + if (u_inact + rq->dl.extra_bw > rq->dl.max_bw - dl_se->dl_bw)
> + u_act = dl_se->dl_bw;
> else
> - u_act = BW_UNIT - u_inact - rq->dl.extra_bw;
> + u_act = rq->dl.max_bw - u_inact - rq->dl.extra_bw;

This again is IMHO OK


Thanks,
Luca