Whamcloud - gitweb
LU-50 kernel: configurable BH LRU size
authoryangsheng <ys@whamcloud.com>
Mon, 5 Dec 2011 14:57:46 +0000 (22:57 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 12 Dec 2011 21:26:34 +0000 (16:26 -0500)
This patch allow per-CPU LRU size to be selected at compile time.
More complex filesystems may be modiyfing multiple blocks
within a single transaction, so keeping more buffer heads in
CPU-local cache speeds up modifications significantly.
User can set LRU size to any value between 8 and 64, linux
kernel is still using 8 and Lustre is going using 16 as
default value.

Signed-off-by: Liang Zhen <liang@whamcloud.com>
Signed-off-by: Yang Sheng <ys@whamcloud.com>
Change-Id: I4bb2eea30d57298b706354dd8438a10dc8ae6e98
Reviewed-on: http://review.whamcloud.com/1796
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
build/lbuild-rhel6
lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-i686.config
lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-x86_64.config
lustre/kernel_patches/patches/bh_lru_size_config.patch [new file with mode: 0644]
lustre/kernel_patches/series/2.6-rhel6.series

index 4381c3f..dcd174a 100644 (file)
@@ -7,7 +7,8 @@
 # distributions, update the BUILD_GEN variable in build/lbuild)
 #BUILD_GEN+=".0"
 #BUILD_GEN+=".1"               # added --with firmware to rpmbuild for rhel6
-BUILD_GEN+=".0"        # TT-107: don't cache the BUILD dir (reset major to 5)
+#BUILD_GEN+=".0"       # TT-107: don't cache the BUILD dir (reset major to 5)
+BUILD_GEN+=".1"        # LU-50: kernel: configurable BH LRU size
 
 source ${0%/*}/lbuild-rhel
 
@@ -33,6 +34,7 @@ ApplyOptionalPatch linux-%{version}-lustre.patch\
     echo "# $Arch" > configs/kernel-%{version}-$Arch.config\
     cat %{_topdir}/lustre/lustre/kernel_patches/kernel_configs/kernel-%{version}-2.6-rhel6-$Arch.config >> configs/kernel-%{version}-$Arch.config\
   fi'\
+           -e '/^# Dynamically generate kernel/a echo "CONFIG_BH_LRU_SIZE=16" >> config-generic'\
           SPECS/$SPEC_NAME 2>&1 || \
         fatal 1 "Error while editing SPECS/$SPEC_NAME"
 
diff --git a/lustre/kernel_patches/patches/bh_lru_size_config.patch b/lustre/kernel_patches/patches/bh_lru_size_config.patch
new file mode 100644 (file)
index 0000000..e84edba
--- /dev/null
@@ -0,0 +1,28 @@
+--- linux-2.6.32-131.6.1/fs/buffer.c
++++ linux-2.6.32-131.6.1-pdo/fs/buffer.c
+@@ -1250,8 +1250,7 @@
+  * The LRUs themselves only need locking against invalidate_bh_lrus.  We use
+  * a local interrupt disable for that.
+  */
+-
+-#define BH_LRU_SIZE   8
++#define BH_LRU_SIZE   CONFIG_BH_LRU_SIZE
+ struct bh_lru {
+       struct buffer_head *bhs[BH_LRU_SIZE];
+--- linux-2.6.32-131.6.1/fs/Kconfig
++++ linux-2.6.32-131.6.1-pdo/fs/Kconfig
+@@ -253,4 +253,13 @@
+ source "fs/nls/Kconfig"
+ source "fs/dlm/Kconfig"
++config BH_LRU_SIZE
++      int "buffer head per-CPU LRU size"
++      range 8 64
++      default "8"
++      help
++        This sets the per-CPU LRU size for buffer heads in memory.
++        More complex filesystems may be modiyfing multiple blocks
++        within a single transaction, so keeping the buffer heads in
++        CPU-local cache speeds up modifations significantly.
+ endmenu
index 52dcc52..d800e10 100644 (file)
@@ -7,3 +7,4 @@ blkdev_tunables-2.6-rhel6.patch
 export-2.6.32-vanilla.patch
 jbd2-jcberr-2.6-rhel6.patch
 fix-forever-in-do_get_write_access.patch
+bh_lru_size_config.patch