From 97497da3c6409988c19089aaa1afbbc212868283 Mon Sep 17 00:00:00 2001 From: yangsheng Date: Mon, 5 Dec 2011 22:57:46 +0800 Subject: [PATCH] LU-50 kernel: configurable BH LRU size 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 Signed-off-by: Yang Sheng Change-Id: I4bb2eea30d57298b706354dd8438a10dc8ae6e98 Reviewed-on: http://review.whamcloud.com/1796 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- build/lbuild-rhel6 | 4 +++- .../kernel-2.6.32-2.6-rhel6-i686.config | 1 + .../kernel-2.6.32-2.6-rhel6-x86_64.config | 1 + .../patches/bh_lru_size_config.patch | 28 ++++++++++++++++++++++ lustre/kernel_patches/series/2.6-rhel6.series | 1 + 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 lustre/kernel_patches/patches/bh_lru_size_config.patch diff --git a/build/lbuild-rhel6 b/build/lbuild-rhel6 index 4381c3f..dcd174a 100644 --- a/build/lbuild-rhel6 +++ b/build/lbuild-rhel6 @@ -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/kernel_configs/kernel-2.6.32-2.6-rhel6-i686.config b/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-i686.config index 04cd1ae..7122929 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-i686.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-i686.config @@ -4196,6 +4196,7 @@ CONFIG_NLS_KOI8_U=m CONFIG_NLS_UTF8=m CONFIG_DLM=m CONFIG_DLM_DEBUG=y +CONFIG_BH_LRU_SIZE=16 # # Kernel hacking diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-x86_64.config b/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-x86_64.config index 331961f..7f2c95f 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-x86_64.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6-x86_64.config @@ -4022,6 +4022,7 @@ CONFIG_NLS_KOI8_U=m CONFIG_NLS_UTF8=m CONFIG_DLM=m CONFIG_DLM_DEBUG=y +CONFIG_BH_LRU_SIZE=16 # # Kernel hacking 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 index 0000000..e84edba --- /dev/null +++ b/lustre/kernel_patches/patches/bh_lru_size_config.patch @@ -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 diff --git a/lustre/kernel_patches/series/2.6-rhel6.series b/lustre/kernel_patches/series/2.6-rhel6.series index 52dcc52..d800e10 100644 --- a/lustre/kernel_patches/series/2.6-rhel6.series +++ b/lustre/kernel_patches/series/2.6-rhel6.series @@ -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 -- 1.8.3.1