Re: [PATCH] Optimize int_sqrt for small values for faster idle

From: Andi Kleen
Date: Tue Feb 09 2016 - 15:44:28 EST


On Sun, Feb 07, 2016 at 10:32:26PM +0100, Rasmus Villemoes wrote:
> On Mon, Feb 01 2016, Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:
>
> > On Mon, Feb 01, 2016 at 10:25:17PM +0100, Rasmus Villemoes wrote:
> >> On Thu, Jan 28 2016, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
> >>
> >> > From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> >> >
> >> > The menu cpuidle governor does at least two int_sqrt() each time
> >> > we go into idle in get_typical_interval to compute stddev
> >> >
> >> > int_sqrts take 100-120 cycles each. Short idle latency is important
> >> > for many workloads.
> >> >
> >>
> >> If you want to optimize get_typical_interval(), why not just take the
> >> square root out of the equation (literally)?
> >>
> >> Something like
> >
> > Looks good. Yes that's a better fix.
> >
>
> Andi, did you have a way to measure the impact, and if so, could I get
> you to run the numbers again with my patch?

I got the numbers from the 0day runs (AIM7 gets faster)
In theory if you post the patch that should happen automatically
(checking with Fengguang)

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only