public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <wfg@mail.ustc.edu.cn>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, Wu Fengguang <wfg@mail.ustc.edu.cn>
Subject: [PATCH 01/23] readahead: kconfig options
Date: Sun, 19 Mar 2006 10:34:14 +0800	[thread overview]
Message-ID: <20060319023448.714508000@localhost.localdomain> (raw)
In-Reply-To: 20060319023413.305977000@localhost.localdomain

[-- Attachment #1: readahead-kconfig-options.patch --]
[-- Type: text/plain, Size: 4248 bytes --]

This patchset introduces a set of adaptive read-ahead methods.
They enable the kernel to better support many important I/O applications.

The functional features include:

- Adaptive read-ahead buffer management
	- aggressive, thrashing safe read-ahead size
		- optimal memory utilisation while achieving good I/O throughput
		- unnecessary to hand tuning VM_MAX_READAHEAD
		- support slow/fast readers at the same time
		- support large number of concurrent readers
	- shrinkable look-ahead size
		- cut down up to 40% memory consumption on overloaded situation

- Support common access patterns
        - multiple streams on one fd
        - backward prefetching
        - sparse reading
        - seeking and reading

- Special case handling
        - nfsd support: the raparams cache is no longer required
	- laptop mode support: defer look-ahead on drive spinned down
        - loopback file support: avoid double look-ahead

The design strategies are:

- Dual methods design
        - stateful method: the fast and default one
	- stateless method: the robust and failsafe one
	- if anything abnormal happens, the stateful method bails out, the
	  stateless method queries the page cache and possibly restart the
	  read-ahead process

- Robust feedback design
	- sense and handle important states so that the logic wont run away
	- detect danger of thrashing and prevent it in advance
        - extensive accounting and debugging traces

This patch:

Add kconfig options to enable/disable:
	- adaptive read-ahead logic
	- adaptive read-ahead debug traces and events accounting

The read-ahead introduction text is cited from the well written LWN article
"Adaptive file readahead" <http://lwn.net/Articles/155510/> :)

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

 mm/Kconfig |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+)

--- linux-2.6.16-rc6-mm2.orig/mm/Kconfig
+++ linux-2.6.16-rc6-mm2/mm/Kconfig
@@ -145,3 +145,58 @@ config MIGRATION
 	  while the virtual addresses are not changed. This is useful for
 	  example on NUMA systems to put pages nearer to the processors accessing
 	  the page.
+
+#
+# Adaptive file readahead
+#
+config ADAPTIVE_READAHEAD
+	bool "Adaptive file readahead (EXPERIMENTAL)"
+	default n
+	depends on EXPERIMENTAL
+	help
+	  Readahead is a technique employed by the kernel in an attempt
+	  to improve file reading performance. If the kernel has reason
+	  to believe that a particular file is being read sequentially,
+	  it will attempt to read blocks from the file into memory before
+	  the application requests them. When readahead works, it speeds
+	  up the system's throughput, since the reading application does
+	  not have to wait for its requests. When readahead fails, instead,
+	  it generates useless I/O and occupies memory pages which are
+	  needed for some other purpose. For sequential readings,
+
+	  Normally, the kernel uses a stock readahead logic that is well
+	  understood and well tuned. This option enables a much complex and
+	  feature rich one. It is more aggressive and memory efficient in
+	  doing readahead, and supports some less-common access patterns such
+	  as reading backward and reading sparsely. However, due to the great
+	  diversity of real world applications, it might not fit everyone.
+
+	  Please refer to Documentation/sysctl/vm.txt for tunable parameters.
+
+	  Say Y here if you are building kernel for file servers.
+	  Say N if you are unsure.
+
+config DEBUG_READAHEAD
+	bool "Readahead debug and accounting"
+	default n
+	depends on ADAPTIVE_READAHEAD
+	select DEBUG_FS
+	help
+	  This option injects extra code to dump detailed debug traces and do
+	  readahead events accounting.
+
+	  To actually get the data:
+
+	  mkdir /debug
+	  mount -t debug none /debug
+
+	  After that you can do the following:
+
+	  echo > /debug/readahead/events # reset the counters
+	  cat /debug/readahead/events    # check the counters
+
+	  echo 1 > /debug/readahead/debug_level # show printk traces
+	  echo 2 > /debug/readahead/debug_level # show verbose printk traces
+	  echo 0 > /debug/readahead/debug_level # stop filling my kern.log
+
+	  Say N, unless you have readahead performance problems.

--

  reply	other threads:[~2006-03-19  2:42 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-19  2:34 [PATCH 00/23] Adaptive read-ahead V11 Wu Fengguang
2006-03-19  2:34 ` Wu Fengguang [this message]
2006-03-19  2:34 ` [PATCH 02/23] radixtree: look-aside cache Wu Fengguang
2006-03-20 16:01   ` Christoph Lameter
2006-03-21  2:19     ` Wu Fengguang
2006-03-19  2:34 ` [PATCH 03/23] radixtree: hole scanning functions Wu Fengguang
2006-03-19  2:34 ` [PATCH 04/23] readahead: page flag PG_readahead Wu Fengguang
2006-03-19  2:34 ` [PATCH 05/23] readahead: refactor do_generic_mapping_read() Wu Fengguang
2006-03-19  2:34 ` [PATCH 06/23] readahead: refactor __do_page_cache_readahead() Wu Fengguang
2006-03-19  2:34 ` [PATCH 07/23] readahead: insert cond_resched() calls Wu Fengguang
2006-03-19  3:50   ` Lee Revell
2006-03-19  5:32     ` Wu Fengguang
2006-03-20 13:31     ` Wu Fengguang
2006-03-19  2:34 ` [PATCH 08/23] readahead: common macros Wu Fengguang
2006-03-19  2:34 ` [PATCH 09/23] readahead: events accounting Wu Fengguang
2006-03-19  2:34 ` [PATCH 10/23] readahead: support functions Wu Fengguang
2006-03-19  2:34 ` [PATCH 11/23] readahead: sysctl parameters Wu Fengguang
2006-03-19  2:34 ` [PATCH 12/23] readahead: min/max sizes Wu Fengguang
2006-03-19  2:34 ` [PATCH 13/23] readahead: page cache aging accounting Wu Fengguang
2006-03-19  2:34 ` [PATCH 14/23] readahead: state based method Wu Fengguang
2006-03-19  2:34 ` [PATCH 15/23] readahead: context " Wu Fengguang
2006-03-19  2:34 ` [PATCH 16/23] readahead: other methods Wu Fengguang
2006-03-19  2:34 ` [PATCH 17/23] readahead: call scheme Wu Fengguang
2006-03-19  2:34 ` [PATCH 18/23] readahead: laptop mode Wu Fengguang
2006-03-19  2:34 ` [PATCH 19/23] readahead: loop case Wu Fengguang
2006-03-19  2:34 ` [PATCH 20/23] readahead: nfsd case Wu Fengguang
2006-03-19  2:34 ` [PATCH 21/23] readahead: debug radix tree new functions Wu Fengguang
2006-03-19  2:34 ` [PATCH 22/23] readahead: debug traces showing accessed file names Wu Fengguang
2006-03-19  2:34 ` [PATCH 23/23] readahead: debug traces showing read patterns Wu Fengguang
2006-03-19  3:10 ` [PATCH 00/23] Adaptive read-ahead V11 Jon Smirl
2006-03-19  3:47   ` Wu Fengguang
2006-03-19  4:10     ` Jon Smirl
2006-03-19  5:09       ` Wu Fengguang
2006-03-19 15:53         ` Jon Smirl
2006-03-20 13:54           ` Wu Fengguang
2006-03-27 21:38   ` Matt Heler
2006-03-28  3:44     ` 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=20060319023448.714508000@localhost.localdomain \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox