Re: Fast patch for Severe I/O performance regression 2.6.6 to 2.6.7or 2.6.8-rc3

From: Ram Pai
Date: Sun Aug 08 2004 - 03:05:28 EST


On Fri, 6 Aug 2004, Mr. Berkley Shands wrote:

> in 2.6.8-rc3/mm/readahead.c line 475 (about label do_io:)
> #if 0
> ra->next_size = min(average , (unsigned long)max);
> #endif
>
> the comment for the above is here after an lseek. The lseek IS inside
> the window, but the code will always
> destroy the window and start again. The above patch corrects the
> performance problem,
> but it would be better to do nothing if the lseek is still within the
> read ahead window.

Ok. I can see your point. I did introduce a subtle change in behavior
in 2.6.8-rc3. The change in behavior is: the current window got populated
based on the average number of contiguous pages accessed in the past.
Earlier to that patch, the current window got populated based on the
amount of locality in the current window, seen in the past.

Try this patch and see if things get back to normal. This patch
populates the current window based on the average amount of locality
noticed in the current window. It should help your case, but who knows
which other benchmark will scream :( . Its hard to keep every workload happy.

In any case try and see if this helps your case atleast. Meanwhile I will
run my set of benchmarks and see what gets effected.

RP


>
> berkley
> -
> 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/
>
--- linux-2.6.8-rc3/mm/readahead.c 2004-08-03 14:26:46.000000000 -0700
+++ ram/linux-2.6.8-rc3/mm/readahead.c 2004-08-08 07:45:40.559431280 -0700
@@ -388,10 +388,7 @@ page_cache_readahead(struct address_spac
goto do_io;
}

- if (offset == ra->prev_page + 1) {
- if (ra->serial_cnt <= (max * 2))
- ra->serial_cnt++;
- } else {
+ if (offset < ra->start || offset > (ra->start + ra->size)) {
/*
* to avoid rounding errors, ensure that 'average'
* tends towards the value of ra->serial_cnt.
@@ -402,9 +399,13 @@ page_cache_readahead(struct address_spac
}
ra->average = (average + ra->serial_cnt) / 2;
ra->serial_cnt = 1;
+ } else {
+ if (ra->serial_cnt <= (max * 2))
+ ra->serial_cnt++;
}
ra->prev_page = offset;

+
if (offset >= ra->start && offset <= (ra->start + ra->size)) {
/*
* A readahead hit. Either inside the window, or one