aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorWu Fengguang <fengguang.wu@intel.com>2011-11-18 20:14:04 -0800
committerZiyan <jaraidaniel@gmail.com>2016-01-08 10:36:19 +0100
commit7b502d63994494a984d6270c41dd50ab4930dbfc (patch)
tree01c6832fc11f216762d6cc427e9280b963401382 /mm
parente847aac49c7179cc54279f7624cabb2e6670318b (diff)
downloadkernel_samsung_tuna-7b502d63994494a984d6270c41dd50ab4930dbfc.tar.gz
kernel_samsung_tuna-7b502d63994494a984d6270c41dd50ab4930dbfc.tar.bz2
kernel_samsung_tuna-7b502d63994494a984d6270c41dd50ab4930dbfc.zip
make default readahead size a kernel parameter
From: Nikanth Karthikesan <knikanth@suse.de> Add new kernel parameter "readahead", which would be used instead of the value of VM_MAX_READAHEAD. If the parameter is not specified, the default of 128kb would be used. Change-Id: I58540d4c3570d23befb9b9f1e27998e832eae88b CC: Ankit Jain <radical@gmail.com> CC: Dave Chinner <david@fromorbit.com> CC: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> Signed-off-by: Nikanth Karthikesan <knikanth@suse.de> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: D. Andrei Măceș <dmaces@nd.edu>
Diffstat (limited to 'mm')
-rw-r--r--mm/readahead.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/mm/readahead.c b/mm/readahead.c
index 867f9dd82dc..df60df9e32c 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -18,6 +18,32 @@
#include <linux/pagevec.h>
#include <linux/pagemap.h>
+unsigned long max_readahead_pages = VM_MAX_READAHEAD * 1024 / PAGE_CACHE_SIZE;
+
+static int __init readahead(char *str)
+{
+ unsigned long bytes;
+
+ if (!str)
+ return -EINVAL;
+ bytes = memparse(str, &str);
+ if (*str != '\0')
+ return -EINVAL;
+
+ if (bytes) {
+ if (bytes < PAGE_CACHE_SIZE) /* missed 'k'/'m' suffixes? */
+ return -EINVAL;
+ if (bytes > 128 << 20) /* limit to 128MB */
+ bytes = 128 << 20;
+ }
+
+ max_readahead_pages = bytes / PAGE_CACHE_SIZE;
+ default_backing_dev_info.ra_pages = max_readahead_pages;
+ return 0;
+}
+
+early_param("readahead", readahead);
+
/*
* Initialise a struct file's readahead state. Assumes that the caller has
* memset *ra to zero.