Skip to content

Commit aed75ff

Browse files
Steven PrattLinus Torvalds
authored andcommitted
[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: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent a564da3 commit aed75ff

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎mm/readahead.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ static unsigned long get_init_ra_size(unsigned long size, unsigned long max)
8383
{
8484
unsigned long newsize = roundup_pow_of_two(size);
8585

86-
if (newsize <= max / 64)
87-
newsize = newsize * newsize;
86+
if (newsize <= max / 32)
87+
newsize = newsize * 4;
8888
else if (newsize <= max / 4)
89-
newsize = max / 4;
89+
newsize = newsize * 2;
9090
else
9191
newsize = max;
9292
return newsize;

0 commit comments

Comments
 (0)