Re: Readahead algorithm problems again...

From: Oleg Nesterov
Date: Thu Aug 04 2005 - 11:33:03 EST


Oleg Nesterov wrote:
>
> What do you think about this patch?

Ohh... Sorry, I attached the wrong one.

--- 2.6.13-rc4/mm/readahead.c~ Thu Apr 7 12:59:41 2005
+++ 2.6.13-rc4/mm/readahead.c Thu Aug 4 20:25:14 2005
@@ -57,8 +57,8 @@ static inline void ra_off(struct file_ra
ra->start = 0;
ra->flags = 0;
ra->size = 0;
+ ra->ahead_size += ra->ahead_start;
ra->ahead_start = 0;
- ra->ahead_size = 0;
return;
}

@@ -423,8 +423,8 @@ static int make_ahead_window(struct addr
* congestion. The ahead window will any way be closed
* in case we failed due to excessive page cache hits.
*/
+ ra->ahead_size += ra->ahead_start;
ra->ahead_start = 0;
- ra->ahead_size = 0;
}

return ret;
@@ -507,7 +507,7 @@ page_cache_readahead(struct address_spac

if (ra->ahead_start == 0) { /* no ahead window yet */
if (!make_ahead_window(mapping, filp, ra, 0))
- goto out;
+ goto recheck;
}
/*
* Already have an ahead window, check if we crossed into it.
@@ -520,6 +520,9 @@ page_cache_readahead(struct address_spac
ra->start = ra->ahead_start;
ra->size = ra->ahead_size;
make_ahead_window(mapping, filp, ra, 0);
+recheck:
+ ra->prev_page = min(ra->prev_page,
+ ra->ahead_start + ra->ahead_size - 1);
}

out:

------------------------------------------------------------------------------

There is another one, from Steven Pratt:

------------------------------------------------------------------------------