Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935068Ab0BZCsm (ORCPT ); Thu, 25 Feb 2010 21:48:42 -0500 Received: from mga02.intel.com ([134.134.136.20]:59513 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934484Ab0BZCsl (ORCPT ); Thu, 25 Feb 2010 21:48:41 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.49,543,1262592000"; d="scan'208";a="599324425" Date: Fri, 26 Feb 2010 10:48:37 +0800 From: Wu Fengguang To: Christian Ehrhardt Cc: Andrew Morton , Jens Axboe , Matt Mackall , Chris Mason , Peter Zijlstra , Clemens Ladisch , Olivier Galibert , Vivek Goyal , Nick Piggin , Linux Memory Management List , "linux-fsdevel@vger.kernel.org" , LKML , Rik van Riel Subject: [PATCH] readahead: add notes on readahead size Message-ID: <20100226024837.GA22859@localhost> References: <20100224031001.026464755@intel.com> <20100224031054.307027163@intel.com> <4B869682.9010709@linux.vnet.ibm.com> <20100226022907.GA22226@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100226022907.GA22226@localhost> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2271 Lines: 61 > readahead: limit read-ahead size for small memory systems > > When lifting the default readahead size from 128KB to 512KB, > make sure it won't add memory pressure to small memory systems. btw, I wrote some comments to summarize the now complex readahead size rules.. == readahead: add notes on readahead size Basically, currently the default max readahead size - is 512k - is boot time configurable with "readahead=" and is auto scaled down: - for small devices - for small memory systems (read-around size alone) CC: Matt Mackall CC: Christian Ehrhardt Signed-off-by: Wu Fengguang --- mm/readahead.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) --- linux.orig/mm/readahead.c 2010-02-26 10:11:41.000000000 +0800 +++ linux/mm/readahead.c 2010-02-26 10:11:55.000000000 +0800 @@ -7,6 +7,28 @@ * Initial version. */ +/* + * Notes on readahead size. + * + * The default max readahead size is VM_MAX_READAHEAD=512k, + * which can be changed by user with boot time parameter "readahead=" + * or runtime interface "/sys/devices/virtual/bdi/default/read_ahead_kb". + * The latter normally only takes effect in future for hot added devices. + * + * The effective max readahead size for each block device can be accessed with + * 1) the `blockdev` command + * 2) /sys/block/sda/queue/read_ahead_kb + * 3) /sys/devices/virtual/bdi/$(env stat -c '%t:%T' /dev/sda)/read_ahead_kb + * + * They are typically initialized with the global default size, however may be + * auto scaled down for small devices in add_disk(). NFS, software RAID, btrfs + * etc. have special rules to setup their default readahead size. + * + * The mmap read-around size typically equals with readahead size, with an + * extra limit proportional to system memory size. For example, a 64MB box + * will have a 64KB read-around size limit, 128MB mem => 128KB limit, etc. + */ + #include #include #include -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/