From: Coywolf Qi Hunt <qiyong@fc-cn.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [patch] bh_lru_install() optimize
Date: Thu, 25 Aug 2005 16:38:37 +0800 [thread overview]
Message-ID: <20050825083837.GA4084@localhost.localdomain> (raw)
Hello,
This optimizes bh_lru_install(). It's a hot spot I think. The bh_lru is well
manipulated now so we can use put_bh() as a substitute for the first __brelse()
here, and a bogus BUG_ON() can be removed safely. We evict at the right place
too. Boot tested.
Coywolf
Signed-off-by: Coywolf Qi Hunt <qiyong@fc-cn.com>
---
buffer.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
--- 2.6.13-rc6-mm2/fs/buffer.c~orig 2005-08-23 13:42:04.000000000 +0800
+++ 2.6.13-rc6-mm2/fs/buffer.c 2005-08-25 16:04:21.000000000 +0800
@@ -1356,7 +1356,6 @@ static inline void check_irqs_on(void)
*/
static void bh_lru_install(struct buffer_head *bh)
{
- struct buffer_head *evictee = NULL;
struct bh_lru *lru;
check_irqs_on();
@@ -1372,15 +1371,14 @@ static void bh_lru_install(struct buffer
for (in = 0; in < BH_LRU_SIZE; in++) {
struct buffer_head *bh2 = lru->bhs[in];
- if (bh2 == bh) {
- __brelse(bh2);
- } else {
+ if (bh2 == bh)
+ put_bh(bh2);
+ else {
if (out >= BH_LRU_SIZE) {
- BUG_ON(evictee != NULL);
- evictee = bh2;
- } else {
+ if (bh2)
+ __brelse(bh2); /* evict bh2 */
+ } else
bhs[out++] = bh2;
- }
}
}
while (out < BH_LRU_SIZE)
@@ -1388,9 +1386,6 @@ static void bh_lru_install(struct buffer
memcpy(lru->bhs, bhs, sizeof(bhs));
}
bh_lru_unlock();
-
- if (evictee)
- __brelse(evictee);
}
/*
reply other threads:[~2005-08-25 8:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050825083837.GA4084@localhost.localdomain \
--to=qiyong@fc-cn.com \
--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