From a9f06a61b2d8c31271afa2501bdf8fa06a772f8b Mon Sep 17 00:00:00 2001 From: nikita Date: Mon, 20 Nov 2006 23:17:56 +0000 Subject: [PATCH] __find_get_block_slow-scale.patch: attempt to reduce contention on bd_mapping->private_lock. --- .../patches/__find_get_block_slow-scale.patch | 43 ++++++++++++++++++++++ lustre/kernel_patches/series/2.6-rhel4.series | 1 + 2 files changed, 44 insertions(+) create mode 100644 lustre/kernel_patches/patches/__find_get_block_slow-scale.patch diff --git a/lustre/kernel_patches/patches/__find_get_block_slow-scale.patch b/lustre/kernel_patches/patches/__find_get_block_slow-scale.patch new file mode 100644 index 0000000..1da92d4 --- /dev/null +++ b/lustre/kernel_patches/patches/__find_get_block_slow-scale.patch @@ -0,0 +1,43 @@ +Index: linux/fs/buffer.c +=================================================================== +--- linux.orig/fs/buffer.c ++++ linux/fs/buffer.c +@@ -509,13 +509,18 @@ __find_get_block_slow(struct block_devic + struct buffer_head *head; + struct page *page; + int all_mapped = 1; ++ int spinlock = 0; + + index = block >> (PAGE_CACHE_SHIFT - bd_inode->i_blkbits); + page = find_get_page(bd_mapping, index); + if (!page) + goto out; + ++ if (unlikely(TestSetPageLocked(page))) { + spin_lock(&bd_mapping->private_lock); ++ spinlock = 1; ++ } ++ + if (!page_has_buffers(page)) + goto out_unlock; + head = page_buffers(page); +@@ -536,7 +541,7 @@ __find_get_block_slow(struct block_devic + * file io on the block device and getblk. It gets dealt with + * elsewhere, don't buffer_error if we had some unmapped buffers + */ +- if (all_mapped) { ++ if (unlikely(all_mapped)) { + printk("__find_get_block_slow() failed. " + "block=%llu, b_blocknr=%llu\n", + (unsigned long long)block, (unsigned long long)bh->b_blocknr); +@@ -544,7 +549,10 @@ __find_get_block_slow(struct block_devic + printk("device blocksize: %d\n", 1 << bd_inode->i_blkbits); + } + out_unlock: ++ if (unlikely(spinlock)) + spin_unlock(&bd_mapping->private_lock); ++ else ++ unlock_page(page); + page_cache_release(page); + out: + return ret; diff --git a/lustre/kernel_patches/series/2.6-rhel4.series b/lustre/kernel_patches/series/2.6-rhel4.series index 2e2736e..cdd7279 100644 --- a/lustre/kernel_patches/series/2.6-rhel4.series +++ b/lustre/kernel_patches/series/2.6-rhel4.series @@ -35,3 +35,4 @@ dynamic-locks-2.6.9.patch jbd-copy-out-everything.patch jbd-checkpoint-on-commit.patch export-nr_free_buffer_pages.patch +__find_get_block_slow-scale.patch -- 1.8.3.1