Re: Random file I/O regressions in 2.6

Ram Pai
2004-05-13T20:43:34Z

On Tue, 2004-05-11 at 14:17, Andrew Morton wrote:
> Ram Pai <linuxram@us.ibm.com> wrote:

I am yet to get my machine fully set up to run a DSS benchmark. But
thought I will update you on the following comment.

>
> multiline comment layout:
>
> /*
> * To avoid rounding errors, ensure that 'average' tends
> * towards the value of ra->serial_cnt.
> */
>
> (I said "minor").
>
> I can't say that I immediately understand what is the issue here with
> rounding errors?

Say the i/o size is 20 pages.

Our algorithm starts by a initial average i/o size of 'ra_pages/2' which
is mostly say 16.

Now every time we take a average, the 'average' progresses as follows
(16+20)/2=18
(18+20)/2=19
(19+20)/2=19
(19+20)/2=19.....
and the rounding error makes it never touch 20

However the code can be further optimized to :

/*
* to avoid rounding errors, ensure that 'average'
* tends towards the value of ra->serial_cnt.
*/
if (ra->average < ra->serial_cnt) {
average = ra->average + 1;
}

I will send a updated patch with all your comments incorporated as soon
as I see good benchmark numbers.(probably by tomorrow).

RP

>
>
> > + if(ra->average > ra->serial_cnt) {
>
> space between "if" and "("
>
> > + ra->next_size = (ra->average > max ?
> > + max : ra->average);
>
> min(max, ra->average) ?
>
>
>