summaryrefslogtreecommitdiff
path: root/mm/readahead.c
diff options
context:
space:
mode:
authorLee Susman <lsusman@codeaurora.org>2013-04-08 13:09:48 +0300
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:03:39 -0700
commit34144c841b1ae040b0575ee6e859ec63609c73a7 (patch)
tree4ec561c265da4ce4f276250aecca7b40c373a7d0 /mm/readahead.c
parent78ec19c5f9a177a11042c5bcd5387ed595e04e1d (diff)
mm: change initial readahead window size calculation
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 <lsusman@codeaurora.org>
Diffstat (limited to 'mm/readahead.c')
-rw-r--r--mm/readahead.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/readahead.c b/mm/readahead.c
index ba22d7fe0afb..72c17e77a6c7 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -234,6 +234,8 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
/*
* 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
@@ -242,7 +244,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;