Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1621096

Re: [PATCH v2] sched/fair: update scale invariance of PELT

From Vincent Guittot <vincent.guittot@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] sched/fair: update scale invariance of PELT
Date 2017-04-11 11:50 +0200
Message-ID <tv0AV-5dh-1@gated-at.bofh.it> (permalink)
References <tuDEl-7d7-3@gated-at.bofh.it> <tuLsf-3QQ-69@gated-at.bofh.it> <tuYSu-463-17@gated-at.bofh.it> <tuZOz-4F4-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Le Tuesday 11 Apr 2017 à 10:53:05 (+0200), Peter Zijlstra a écrit :
> On Tue, Apr 11, 2017 at 09:52:21AM +0200, Vincent Guittot wrote:
> > Le Monday 10 Apr 2017 à 19:38:02 (+0200), Peter Zijlstra a écrit :
> > > 
> > > Thanks for the rebase.
> > > 
> > > On Mon, Apr 10, 2017 at 11:18:29AM +0200, Vincent Guittot wrote:
> > > 
> > > Ok, so let me try and paraphrase what this patch does.
> > > 
> > > So consider a task that runs 16 out of our 32ms window:
> > > 
> > >    running   idle
> > >   |---------|---------|
> > > 
> > > 
> > > You're saying that when we scale running with the frequency, suppose we
> > > were at 50% freq, we'll end up with:
> > > 
> > >    run  idle
> > >   |----|---------|
> > > 
> > > 
> > > Which is obviously a shorter total then before; so what you do is add
> > > back the lost idle time like:
> > > 
> > >    run  lost idle
> > >   |----|----|---------|
> > > 
> > > 
> > > to arrive at the same total time. Which seems to make sense.
> > 
> > Yes
> 
> OK, bear with me.
> 
> 
> So we have:
> 
> 
>   util_sum' = utilsum * y^p +
> 
>                                  p-1
>               d1 * y^p + 1024 * \Sum y^n + d3 * y^0
> 	                         n=1
> 
> For the unscaled version, right?

Yes for the running state.

For sleeping state, it's just util_sum' = utilsum * y^p

>
>
> 
> Now for the scaled version, instead of adding a full 'd1,d2,d3' running
> segments, we want to add partially running segments, where r=f*d/f_max,
> and lost segments l=d-r to fill out the idle time.
> 
> But afaict we then end up with (F=f/f_max):
> 
> 
>   util_sum' = utilsum * y^p +
> 
>                                          p-1
>               F * d1 * y^p + F * 1024 * \Sum y^n + F * d3 * y^0
> 	                                 n=1

you also have a longer running time as it runs slower. We make the assumption that
d1+d2+d3 = (d1'+d2'+d3') * F

If we consider that we cross a decay window, we still have the d1 to complete
the past one but then p'*F= p and d'3 will be the remaining part of the
current window and most probably not equal to d3

so we have with current invariance:

   util_sum' = utilsum * y^(p/F) + 
                                              (p/F - 1)
               F * d1 * y^(p/F) + F * 1024 * \Sum y^n + F * d'3 * y^0
 	                                          n=1

with the new invariance we have

   util_sum' = utilsum * y^(F*p/F) + 
                                        (F*p/F - 1)
               d1 * y^(F*p/F) + 1024 * \Sum y^n + d3 * y^0
 	                                    n=1

For a sleeping time of d at max capacity, we have
a sleeping time d'=d-l, with l the lost time of the previous running time
With the current implementation: 
  util_sum' = utilsum * y^(p')
  util_sum' = utilsum * y^(p-l)

With the new invaraince, we have 
  util_sum' = utilsum * y^(p'+l)
  util_sum' = utilsum * y^(p-l+l)

> 
> And we can collect the common term F:
> 
>   util_sum' = utilsum * y^p +
> 
>                                       p-1
>               F * (d1 * y^p + 1024 * \Sum y^n + d3 * y^0)
> 	                              n=1
> 
> 
> Which is exactly what we already did.

In the new invariance scale, the F is applied on p not on the contribution
value

>
> 
> So now I'm confused. Where did I go wrong?
> 
> 
> Because by scaling the contribution we get the exact result of doing the
> smaller 'running' + 'lost' segments.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-10 19:40 +0200
  Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 10:00 +0200
    Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-11 11:00 +0200
      Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 11:50 +0200
        Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-11 12:50 +0200
          Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-11 13:00 +0200
            Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 15:10 +0200
              Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-12 13:30 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-12 17:00 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-12 17:50 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-13 11:50 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-13 15:40 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-13 17:00 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-13 20:10 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-14 10:50 +0200
          Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 14:10 +0200
    Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-11 11:20 +0200
      Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 11:50 +0200
    Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-13 15:40 +0200
      Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-13 17:20 +0200
        Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-13 18:20 +0200
          Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-14 11:00 +0200
            Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-19 18:40 +0200

csiph-web