readahead: fix initial window size calculation
Subsystems (2)
PATCH 1/1 readahead: fix initial window size calculation
(I hope it is ok to send this patch without Steven's reply)
From: Steven Pratt <[email protected]>
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
mm/readahead.c renamed from mm/readahead.c~ +3 -3
@@ -83,10 +83,10 @@ static unsigned long get_init_ra_size(un {unsigned long newsize =roundup_pow_of_two (size); -if (newsize <= max /64 ) - newsize = newsize * newsize; +if (newsize <= max /32 ) + newsize = newsize *4 ;else if (newsize <= max /4 ) - newsize = max /4 ; + newsize = newsize *2 ;else newsize = max;return newsize;
Quoted 3 lines · Oleg Nesterov
(I hope it is ok to send this patch without Steven's reply)
Yes, It is fine.
Quoted 57 lines
From: Steven Pratt <[email protected]>
The current current
get_init_ra_sizeis not optimal across different IO sizes andmax_readaheadvalues. 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 32k128k max, 4k request
old new
-----------------32k 16k 64k 32k 128k 64k128k 128k
128k max, 32k request
old new
-----------------
32k 64k <-----
64k 128k
128k 128k512k max, 4k request
old new
-----------------
4k 32k <----
16k 64k64k 128k 128k 256k 512k 512kmm/readahead.c renamed from mm/readahead.c~ +3
-3@@ -83,10 +83,10 @@ static unsigned long get_init_ra_size(un {unsigned long newsize =roundup_pow_of_two (size); -if (newsize <= max /64 ) - newsize = newsize * newsize; +if (newsize <= max /32 ) + newsize = newsize *4 ;else if (newsize <= max /4 ) - newsize = max /4 ; + newsize = newsize *2 ;else newsize = max;return newsize;