Skip to content

Commit

Permalink
mm: change initial readahead window size calculation
Browse files Browse the repository at this point in the history
Change the logic which determines the initial readahead window size
such that for small requests (one page) the initial window size
will be x4 the size of the original request, regardless of the
VM_MAX_READAHEAD value. This prevents a rapid ramp-up
that could be caused due to increasing VM_MAX_READAHEAD.

Change-Id: I93d59c515d7e6c6d62348790980ff7bd4f434997
Signed-off-by: Lee Susman <[email protected]>
  • Loading branch information
Lee Susman committed Apr 8, 2013
1 parent 9a87969 commit 7893b2e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/readahead.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ unsigned long ra_submit(struct file_ra_state *ra,

/*
* Set the initial window size, round to next power of 2 and square
* Small size is not dependant on max value - only a one-page read is regarded
* as small.
* for small size, x 4 for medium, and x 2 for large
* for 128k (32 page) max ra
* 1-8 page = 32k initial, > 8 page = 128k initial
Expand All @@ -269,7 +271,7 @@ static unsigned long get_init_ra_size(unsigned long size, unsigned long max)
{
unsigned long newsize = roundup_pow_of_two(size);

if (newsize <= max / 32)
if (newsize <= 1)
newsize = newsize * 4;
else if (newsize <= max / 4)
newsize = newsize * 2;
Expand Down

0 comments on commit 7893b2e

Please sign in to comment.