Re: [PATCH 1/2] sched/deadline: accurate reclaim bandwidth for GRUB

From: luca abeni
Date: Thu May 11 2023 - 03:37:30 EST


Hi,

On Wed, 10 May 2023 11:50:00 -0400
Vineeth Remanan Pillai <vineeth@xxxxxxxxxxxxxxx> wrote:
[...]
> > the "1 - u_inact - u_extra" part is needed to make sure that the
> > real-time guarantees are not broken by the reclaiming mechanism...
> > But it can end up with a task trying to consume too much time on a
> > single CPU, hence the "u/Umax" term in the "max{}" is needed to
> > make sure that a task will not consume more than Umax of a CPU.
> >
> > Now, if we have one single task on a CPU u/Umax will always be
> > larger than the other term... But when we have multiple tasks the
> > other term is needed too.
> >
> Understood, thanks for explaining.
>
> > (BTW, when considering multiple tasks on multiple CPUs, another
> > potential problem is given by u_extra... Now that I remember all the
> > details, u_extra is not "Umax - this_bw" - this is true when we
> > consider only one CPU, but is is "Umax - sum(u_i)/m" (where
> > "sum(u_i)" is the sum of the bandwidths of all the SCHED_DEADLINE
> > tasks in the root domain, and "m" is the number of CPUs in the root
> > domain)... So, the reclaimable CPU time is distributed uniformly on
> > all the CPUs and this could create some issues. But let's see what
> > happens after the div64 fix and the SCHED_FLAG_RECLAIM fix)
> >
> This makes sense. This also means that we wouldn't be able to replace
> "Uextra + Uinact" with "Umax - running_bw"

Right. When I suggested it, I was mistaken (I probably mis-read some
comments, and I did not remember how u_extra is exactly computed)


> and I was seeing problems
> with SMP testing. So I shall revert to "Uextra + Uinact" in v2. And I
> think the potential issue with Uextra would be avoided by the check
> for Uextra + Uinact > Umax to make sure that we don't reclaim more
> than Umax for a single cpu.
>
> I have tested the patch with SMP using the stressor mentioned in the
> commit message and running cyclicdeadline in parallel. The results
> are similar to upstream and GRUB able to reclaim upto Umax now.
>
> I shall send the v2 soon after a bit more testing..

I've just seen v2, and (unless I misunderstand something) I see you
removed the max{u_i/u_max, 1 - (u_inact + u_extra}} thing?

I fear this might break the real-time guarantees provided by the
algorithm...


> Thanks a lot for all the valuable inputs and detailed explanation :-)

And thank you for addressing this issue and listening to me :)



Thanks,
Luca