All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Steven Pratt <slpratt@austin.ibm.com>
Cc: Ram Pai <linuxram@us.ibm.com>
Subject: [PATCH 3/9] readahead: MIN_RA_PAGES/MAX_RA_PAGES macros
Date: Thu, 17 May 2007 06:47:55 +0800	[thread overview]
Message-ID: <379355695.94408@ustc.edu.cn> (raw)
Message-ID: <20070516224818.544351896@mail.ustc.edu.cn> (raw)
In-Reply-To: 20070516224752.500812933@mail.ustc.edu.cn

[-- Attachment #1: readahead-minmax_ra_pages.patch --]
[-- Type: text/plain, Size: 1467 bytes --]

Define two convenient macros for read-ahead:
	- MAX_RA_PAGES: rounded down counterpart of VM_MAX_READAHEAD
	- MIN_RA_PAGES: rounded _up_ counterpart of VM_MIN_READAHEAD

Note that the rounded up MIN_RA_PAGES will work flawlessly with _large_
page sizes like 64k.

Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---

 mm/readahead.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- linux-2.6.22-rc1-mm1.orig/mm/readahead.c
+++ linux-2.6.22-rc1-mm1/mm/readahead.c
@@ -21,8 +21,16 @@ void default_unplug_io_fn(struct backing
 }
 EXPORT_SYMBOL(default_unplug_io_fn);
 
+/*
+ * Convienent macros for min/max read-ahead pages.
+ * Note that MAX_RA_PAGES is rounded down, while MIN_RA_PAGES is rounded up.
+ * The latter is necessary for systems with large page size(i.e. 64k).
+ */
+#define MAX_RA_PAGES	(VM_MAX_READAHEAD*1024 / PAGE_CACHE_SIZE)
+#define MIN_RA_PAGES	DIV_ROUND_UP(VM_MIN_READAHEAD*1024, PAGE_CACHE_SIZE)
+
 struct backing_dev_info default_backing_dev_info = {
-	.ra_pages	= (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE,
+	.ra_pages	= MAX_RA_PAGES,
 	.state		= 0,
 	.capabilities	= BDI_CAP_MAP_COPY,
 	.unplug_io_fn	= default_unplug_io_fn,
@@ -51,7 +59,7 @@ static inline unsigned long get_max_read
 
 static inline unsigned long get_min_readahead(struct file_ra_state *ra)
 {
-	return (VM_MIN_READAHEAD * 1024) / PAGE_CACHE_SIZE;
+	return MIN_RA_PAGES;
 }
 
 static inline void reset_ahead_window(struct file_ra_state *ra)

--

  parent reply	other threads:[~2007-05-16 22:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16 22:47 [PATCH 0/9] on-demand readahead Fengguang Wu
2007-05-16 22:47 ` Fengguang Wu
2007-05-16 22:47 ` [PATCH 1/9] readahead: introduce PG_readahead Fengguang Wu
2007-05-16 22:47   ` Fengguang Wu
2007-05-19  6:28     ` Andrew Morton
2007-05-19 11:35       ` Andi Kleen
2007-05-19 15:19         ` Andrew Morton
2007-05-19 12:30       ` Fengguang Wu
2007-05-19 12:30         ` Fengguang Wu
2007-05-19 15:25           ` Andrew Morton
2007-05-20  3:09             ` Fengguang Wu
2007-05-20  3:09               ` Fengguang Wu
2007-05-20  7:10                 ` Christoph Lameter
2007-06-12  1:04   ` Rusty Russell
2007-06-12  2:52     ` Fengguang Wu
2007-06-12  2:52       ` Fengguang Wu
2007-05-16 22:47 ` [PATCH 2/9] readahead: add look-ahead support to __do_page_cache_readahead() Fengguang Wu
2007-05-16 22:47   ` Fengguang Wu
2007-05-16 22:47 ` Fengguang Wu [this message]
2007-05-16 22:47   ` [PATCH 3/9] readahead: MIN_RA_PAGES/MAX_RA_PAGES macros Fengguang Wu
2007-05-16 22:47 ` [PATCH 4/9] readahead: data structure and routines Fengguang Wu
2007-05-16 22:47   ` Fengguang Wu
2007-06-12  3:30   ` Rusty Russell
2007-06-12 12:07     ` Fengguang Wu
2007-06-12 12:07       ` Fengguang Wu
2007-06-13  0:27       ` Rusty Russell
2007-06-13  3:07         ` Fengguang Wu
2007-06-13  3:07           ` Fengguang Wu
2007-05-16 22:47 ` [PATCH 5/9] readahead: on-demand readahead logic Fengguang Wu
2007-05-16 22:47   ` Fengguang Wu
2007-05-19  6:23     ` Andrew Morton
2007-05-19 13:02       ` Fengguang Wu
2007-05-19 13:02         ` Fengguang Wu
2007-06-12  4:36   ` Rusty Russell
2007-06-12 10:35     ` Fengguang Wu
2007-06-12 10:35       ` Fengguang Wu
2007-06-13  1:40       ` Rusty Russell
2007-06-13  4:00         ` Fengguang Wu
2007-06-13  4:00           ` Fengguang Wu
2007-06-13  5:51           ` Rusty Russell
2007-06-13  7:07             ` Fengguang Wu
2007-06-13  7:07               ` Fengguang Wu
2007-05-16 22:47 ` [PATCH 6/9] readahead: convert filemap invocations Fengguang Wu
2007-05-16 22:47   ` Fengguang Wu
2007-05-16 22:47 ` [PATCH 7/9] readahead: convert splice invocations Fengguang Wu
2007-05-16 22:47   ` Fengguang Wu
2007-05-16 22:48 ` [PATCH 8/9] readahead: convert ext3/ext4 invocations Fengguang Wu
2007-05-16 22:48   ` Fengguang Wu
2007-05-19 12:19   ` Andi Kleen
2007-05-16 22:48 ` [PATCH 9/9] readahead: remove the old algorithm Fengguang Wu
2007-05-16 22:48   ` Fengguang Wu
2007-05-19 12:18   ` Andi Kleen
2007-05-19 13:17     ` Fengguang Wu
2007-05-19 13:17       ` Fengguang Wu

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=379355695.94408@ustc.edu.cn \
    --to=wfg@mail.ustc.edu.cn \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.