Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Juri Lelli
Hi, On 08/04/16 12:54, Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 03:31:41AM -0700, Joe Perches wrote: > > On Fri, 2016-04-08 at 10:07 +0800, Yuyang Du wrote: > > > __compute_runnable_contrib() uses a loop to compute sum, whereas a > > > table lookup can do it faster in a constant time. > >

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Juri Lelli
Hi, On 08/04/16 12:54, Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 03:31:41AM -0700, Joe Perches wrote: > > On Fri, 2016-04-08 at 10:07 +0800, Yuyang Du wrote: > > > __compute_runnable_contrib() uses a loop to compute sum, whereas a > > > table lookup can do it faster in a constant time. > >

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Morten Rasmussen
On Fri, Apr 08, 2016 at 10:07:20AM +0800, Yuyang Du wrote: > __compute_runnable_contrib() uses a loop to compute sum, whereas a > table loopup can do it faster in a constant time. > > Signed-off-by: Yuyang Du > --- > kernel/sched/fair.c | 20 > 1 file

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Morten Rasmussen
On Fri, Apr 08, 2016 at 10:07:20AM +0800, Yuyang Du wrote: > __compute_runnable_contrib() uses a loop to compute sum, whereas a > table loopup can do it faster in a constant time. > > Signed-off-by: Yuyang Du > --- > kernel/sched/fair.c | 20 > 1 file changed, 12

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 03:31:41AM -0700, Joe Perches wrote: > On Fri, 2016-04-08 at 10:07 +0800, Yuyang Du wrote: > > __compute_runnable_contrib() uses a loop to compute sum, whereas a > > table lookup can do it faster in a constant time. > > Perhaps this becomes rather fragile code overly

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 03:31:41AM -0700, Joe Perches wrote: > On Fri, 2016-04-08 at 10:07 +0800, Yuyang Du wrote: > > __compute_runnable_contrib() uses a loop to compute sum, whereas a > > table lookup can do it faster in a constant time. > > Perhaps this becomes rather fragile code overly

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 12:44:32PM +0200, Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 10:07:20AM +0800, Yuyang Du wrote: > > __compute_runnable_contrib() uses a loop to compute sum, whereas a > > table loopup can do it faster in a constant time. > > > - /* Compute \Sum k^n combining

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 12:44:32PM +0200, Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 10:07:20AM +0800, Yuyang Du wrote: > > __compute_runnable_contrib() uses a loop to compute sum, whereas a > > table loopup can do it faster in a constant time. > > > - /* Compute \Sum k^n combining

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 10:07:20AM +0800, Yuyang Du wrote: > __compute_runnable_contrib() uses a loop to compute sum, whereas a > table loopup can do it faster in a constant time. > - /* Compute \Sum k^n combining precomputed values for k^i, \Sum k^j */ > - do { > - contrib /=

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 10:07:20AM +0800, Yuyang Du wrote: > __compute_runnable_contrib() uses a loop to compute sum, whereas a > table loopup can do it faster in a constant time. > - /* Compute \Sum k^n combining precomputed values for k^i, \Sum k^j */ > - do { > - contrib /=

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Joe Perches
On Fri, 2016-04-08 at 10:07 +0800, Yuyang Du wrote: > __compute_runnable_contrib() uses a loop to compute sum, whereas a > table lookup can do it faster in a constant time. Perhaps this becomes rather fragile code overly dependent on the current #define values of LOAD_AVG_MAX_N and

Re: [PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Joe Perches
On Fri, 2016-04-08 at 10:07 +0800, Yuyang Du wrote: > __compute_runnable_contrib() uses a loop to compute sum, whereas a > table lookup can do it faster in a constant time. Perhaps this becomes rather fragile code overly dependent on the current #define values of LOAD_AVG_MAX_N and

[PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Yuyang Du
__compute_runnable_contrib() uses a loop to compute sum, whereas a table loopup can do it faster in a constant time. Signed-off-by: Yuyang Du --- kernel/sched/fair.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git

[PATCH] sched/fair: Optimize sum computation with a lookup table

2016-04-08 Thread Yuyang Du
__compute_runnable_contrib() uses a loop to compute sum, whereas a table loopup can do it faster in a constant time. Signed-off-by: Yuyang Du --- kernel/sched/fair.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c