lkml.org 
[lkml]   [2005]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] bh_lru_install() optimize
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);
}

/*
-
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/
\
 
 \ /
  Last update: 2005-08-25 10:42    [W:0.028 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site