Messages in this thread | | | Date | Fri, 31 Mar 2017 09:13:52 +0200 | From | Peter Zijlstra <> | Subject | Re: [RESEND PATCH 2/2] sched/fair: Optimize __update_sched_avg() |
| |
On Fri, Mar 31, 2017 at 03:41:18AM +0800, Yuyang Du wrote:
> > > > > > p > > > c2 = 1024 \Sum y^n > > > n=1 > > > > > > inf inf > > > = 1024 ( \Sum y^n - \Sum y^n - y^0 ) > > > n=0 n=p > > > > It looks surprisingly kinda works :) > > > > > + c2 = LOAD_AVG_MAX - decay_load(LOAD_AVG_MAX, periods) - 1024; > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > But, I'm not sure this is what you want (just assume p==0). > > > > Oh, what I meant is when p != 0, actually p>=1.
Right, note that we'll never get here with p==0. For p==1 we'll have c2==0, and for p > 1 we'll have whatever section we wanted.
> And thinking about it for a while, it's really what you want, brilliant :)
Right, because:
inf inf inf ( \Sum y^n ) y^p = \Sum y^(n+p) = \Sum y^n n=0 n=0 n=p
| |