Re: [PATCH] sched: fix/optimise calculation of weight-inverse

From: Peter Zijlstra
Date: Wed May 11 2011 - 12:40:22 EST


On Wed, 2011-05-11 at 18:20 +0200, Ingo Molnar wrote:
> > - lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2)
> > - / (lw->weight+1);
> > + lw->inv_weight = WMULT_CONST / lw->weight;
>
> hm, i definitely think there was a rounding reason for that - but apparently
> i'm an idiot who does not add comments to non-obvious code! :-)

I suspect I might be the idiot,

> Peter, do you remember this?

I think what we wanted to do was minimize the error:
err = weight - inv*WMULT_CONST

by adding another term. But we could well have simply made a mess of it
instead.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/