Commit aed75ff3 authored by Steven Pratt's avatar Steven Pratt Committed by Linus Torvalds

[PATCH] readahead: fix initial window size calculation

The current current get_init_ra_size is not optimal across different IO
sizes and max_readahead values.  Here is a quick summary of sizes computed
under current design and under the attached patch.  All of these assume 1st
IO at offset 0, or 1st detected sequential IO.

	32k max, 4k request

	old         new
	-----------------
	 8k        8k
	16k       16k
	32k       32k

	128k max, 4k request
	old         new
	-----------------
	32k         16k
	64k         32k
	128k        64k
	128k       128k

	128k max, 32k request
	old         new
	-----------------
	32k         64k    <-----
	64k        128k
	128k       128k

	512k max, 4k request
	old         new
	-----------------
	4k         32k     <----
	16k        64k
	64k       128k
	128k      256k
	512k      512k

Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Steven Pratt <slpratt@austin.ibm.com>
Cc: Ram Pai <linuxram@us.ibm.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a564da39
...@@ -83,10 +83,10 @@ static unsigned long get_init_ra_size(unsigned long size, unsigned long max) ...@@ -83,10 +83,10 @@ static unsigned long get_init_ra_size(unsigned long size, unsigned long max)
{ {
unsigned long newsize = roundup_pow_of_two(size); unsigned long newsize = roundup_pow_of_two(size);
if (newsize <= max / 64) if (newsize <= max / 32)
newsize = newsize * newsize; newsize = newsize * 4;
else if (newsize <= max / 4) else if (newsize <= max / 4)
newsize = max / 4; newsize = newsize * 2;
else else
newsize = max; newsize = max;
return newsize; return newsize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment