Re: Re: [PATCH 01/15] sched/fair: Add avg_vruntime
From: Peter Zijlstra
Date: Wed Oct 11 2023 - 06:06:18 EST
On Wed, Oct 11, 2023 at 11:45:39AM +0200, Peter Zijlstra wrote:
> On Wed, Oct 11, 2023 at 04:30:26PM +0800, Abel Wu wrote:
> > On 10/11/23 3:30 PM, Peter Zijlstra Wrote:
> > > On Wed, Oct 11, 2023 at 12:15:28PM +0800, Abel Wu wrote:
> > > > On 5/31/23 7:58 PM, Peter Zijlstra wrote:
> > > > > +/*
> > > > > + * Compute virtual time from the per-task service numbers:
> > > > > + *
> > > > > + * Fair schedulers conserve lag:
> > > > > + *
> > > > > + * \Sum lag_i = 0
> > > > > + *
> > > > > + * Where lag_i is given by:
> > > > > + *
> > > > > + * lag_i = S - s_i = w_i * (V - v_i)
> > > >
> > > > Since the ideal service time S is task-specific, should this be:
> > > >
> > > > lag_i = S_i - s_i = w_i * (V - v_i)
> > >
> > > It is not, S is the same for all tasks. Remember, the base form is a
> > > differential equation and all tasks progress at the same time at dt/w_i
> > > while S progresses at dt/W.
> >
> > IIUC it's V progresses at dt/W and is same for all tasks, not S which is
> > measured in real time (V*w_i).
>
> Clearly I should wake up before replying ;-)
>
> V = S/W, so dV = dt/W and dS = dt
>
> Anyway, the point is that both V and S are the same across all tasks,
> all tasks execute in parallel with infinitely small time increments.
>
> In reality this can't work ofc, so we get the approximations v_i and s_i
> and lag is the deviation from the ideal.
Ah, I think I see. I'm making a mess of things aren't I.
I've got to run some errands, but I'll try and reply more coherently
after.