From: Wu Fengguang <fengguang.wu@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Memory Management List <linux-mm@kvack.org>,
<linux-fsdevel@vger.kernel.org>, Ankit Jain <radical@gmail.com>,
Dave Chinner <david@fromorbit.com>,
Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>,
Rik van Riel <riel@redhat.com>,
Nikanth Karthikesan <knikanth@suse.de>,
Wu Fengguang <fengguang.wu@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Subject: [PATCH 2/8] readahead: make default readahead size a kernel parameter
Date: Mon, 21 Nov 2011 17:18:21 +0800 [thread overview]
Message-ID: <20111121093846.251104145@intel.com> (raw)
In-Reply-To: 20111121091819.394895091@intel.com
[-- Attachment #1: readahead-kernel-parameter.patch --]
[-- Type: text/plain, Size: 3085 bytes --]
From: Nikanth Karthikesan <knikanth@suse.de>
Add new kernel parameter "readahead=", which allows user to override
the static VM_MAX_READAHEAD=128kb.
CC: Ankit Jain <radical@gmail.com>
CC: Dave Chinner <david@fromorbit.com>
CC: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
Documentation/kernel-parameters.txt | 6 ++++++
block/blk-core.c | 3 +--
fs/fuse/inode.c | 2 +-
mm/readahead.c | 19 +++++++++++++++++++
4 files changed, 27 insertions(+), 3 deletions(-)
--- linux-next.orig/Documentation/kernel-parameters.txt 2011-10-19 11:11:14.000000000 +0800
+++ linux-next/Documentation/kernel-parameters.txt 2011-11-20 11:09:56.000000000 +0800
@@ -2245,6 +2245,12 @@ bytes respectively. Such letter suffixes
Run specified binary instead of /init from the ramdisk,
used for early userspace startup. See initrd.
+ readahead=nn[KM]
+ Default max readahead size for block devices.
+
+ This default max readahead size may be overrode
+ in some cases, notably NFS, btrfs and software RAID.
+
reboot= [BUGS=X86-32,BUGS=ARM,BUGS=IA-64] Rebooting mode
Format: <reboot_mode>[,<reboot_mode2>[,...]]
See arch/*/kernel/reboot.c or arch/*/kernel/process.c
--- linux-next.orig/block/blk-core.c 2011-11-08 10:18:16.000000000 +0800
+++ linux-next/block/blk-core.c 2011-11-20 10:49:33.000000000 +0800
@@ -462,8 +462,7 @@ struct request_queue *blk_alloc_queue_no
if (!q)
return NULL;
- q->backing_dev_info.ra_pages =
- (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
+ q->backing_dev_info.ra_pages = default_backing_dev_info.ra_pages;
q->backing_dev_info.state = 0;
q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY;
q->backing_dev_info.name = "block";
--- linux-next.orig/fs/fuse/inode.c 2011-11-08 10:18:39.000000000 +0800
+++ linux-next/fs/fuse/inode.c 2011-11-20 10:50:12.000000000 +0800
@@ -878,7 +878,7 @@ static int fuse_bdi_init(struct fuse_con
int err;
fc->bdi.name = "fuse";
- fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
+ fc->bdi.ra_pages = default_backing_dev_info.ra_pages;
/* fuse does it's own writeback accounting */
fc->bdi.capabilities = BDI_CAP_NO_ACCT_WB;
--- linux-next.orig/mm/readahead.c 2011-11-20 10:48:57.000000000 +0800
+++ linux-next/mm/readahead.c 2011-11-20 11:09:22.000000000 +0800
@@ -18,6 +18,25 @@
#include <linux/pagevec.h>
#include <linux/pagemap.h>
+static int __init config_readahead_size(char *str)
+{
+ unsigned long bytes;
+
+ if (!str)
+ return -EINVAL;
+ bytes = memparse(str, &str);
+ if (*str != '\0')
+ return -EINVAL;
+
+ /* missed 'k'/'m' suffixes? */
+ if (bytes && bytes < PAGE_CACHE_SIZE)
+ return -EINVAL;
+
+ default_backing_dev_info.ra_pages = bytes / PAGE_CACHE_SIZE;
+ return 0;
+}
+early_param("readahead", config_readahead_size);
+
/*
* Initialise a struct file's readahead state. Assumes that the caller has
* memset *ra to zero.
next prev parent reply other threads:[~2011-11-21 9:41 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 9:18 [PATCH 0/8] readahead stats/tracing, backwards prefetching and more Wu Fengguang
2011-11-21 9:18 ` [PATCH 1/8] block: limit default readahead size for small devices Wu Fengguang
2011-11-21 10:00 ` Christoph Hellwig
2011-11-21 11:24 ` Wu Fengguang
2011-11-21 12:47 ` Andi Kleen
2011-11-21 14:46 ` Jeff Moyer
2011-11-21 22:52 ` Andrew Morton
2011-11-22 14:23 ` Jeff Moyer
2011-11-23 12:18 ` Wu Fengguang
2011-11-21 9:18 ` Wu Fengguang [this message]
2011-11-21 10:01 ` [PATCH 2/8] readahead: make default readahead size a kernel parameter Christoph Hellwig
2011-11-21 11:35 ` Wu Fengguang
2011-11-24 22:28 ` Jan Kara
2011-11-25 0:36 ` Dave Chinner
2011-11-28 2:39 ` Wu Fengguang
2011-11-30 13:04 ` Christian Ehrhardt
2011-11-30 13:29 ` Wu Fengguang
2011-11-30 16:09 ` Jan Kara
2011-11-21 9:18 ` [PATCH 3/8] readahead: replace ra->mmap_miss with ra->ra_flags Wu Fengguang
2011-11-21 11:04 ` Steven Whitehouse
2011-11-21 11:42 ` Wu Fengguang
2011-11-21 23:01 ` Andrew Morton
2011-11-23 12:47 ` Wu Fengguang
2011-11-23 20:31 ` Andrew Morton
2011-11-29 3:42 ` Wu Fengguang
2011-11-21 9:18 ` [PATCH 4/8] readahead: record readahead patterns Wu Fengguang
2011-11-21 23:19 ` Andrew Morton
2011-11-29 2:40 ` Wu Fengguang
2011-11-21 9:18 ` [PATCH 5/8] readahead: add /debug/readahead/stats Wu Fengguang
2011-11-21 14:17 ` Andi Kleen
2011-11-22 14:14 ` Wu Fengguang
2011-11-21 23:29 ` Andrew Morton
2011-11-21 23:32 ` Andi Kleen
2011-11-29 3:23 ` Wu Fengguang
2011-11-29 4:49 ` Andrew Morton
2011-11-29 6:41 ` Wu Fengguang
2011-11-29 12:29 ` Wu Fengguang
2011-11-21 9:18 ` [PATCH 6/8] readahead: add debug tracing event Wu Fengguang
2011-11-21 14:01 ` Steven Rostedt
2011-11-21 9:18 ` [PATCH 7/8] readahead: basic support for backwards prefetching Wu Fengguang
2011-11-21 23:33 ` Andrew Morton
2011-11-29 3:08 ` Wu Fengguang
2011-11-21 9:18 ` [PATCH 8/8] readahead: dont do start-of-file readahead after lseek() Wu Fengguang
2011-11-21 23:36 ` Andrew Morton
2011-11-22 14:18 ` Wu Fengguang
2011-11-21 9:56 ` [PATCH 0/8] readahead stats/tracing, backwards prefetching and more Christoph Hellwig
2011-11-21 12:00 ` Wu Fengguang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111121093846.251104145@intel.com \
--to=fengguang.wu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=ehrhardt@linux.vnet.ibm.com \
--cc=knikanth@suse.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=radical@gmail.com \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).