Re: [PATCH 5/15] cfq-iosched: speed up rbtree handling

From: Alan D. Brunelle
Date: Wed Apr 25 2007 - 12:00:22 EST


Hi Jens -

The attached patch speeds it up even more - I'm finding a >9% reduction in %system with no loss in IO performance. This just sets the cached element when the first is looked for.

Alan From: Alan D. Brunelle <Alan.Brunelle@xxxxxx>

Update cached leftmost every time it is found.

Signed-off-by: Alan D. Brunelle <Alan.Brunelle@xxxxxx>
---

block/cfq-iosched.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 8093733..a86a7c3 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -388,10 +388,10 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2)
*/
static struct rb_node *cfq_rb_first(struct cfq_rb_root *root)
{
- if (root->left)
- return root->left;
+ if (!root->left)
+ root->left = rb_first(&root->rb);

- return rb_first(&root->rb);
+ return root->left;
}

static void cfq_rb_erase(struct rb_node *n, struct cfq_rb_root *root)