[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20081209102148.GE14862@ff.dom.local>
Date: Tue, 9 Dec 2008 10:21:48 +0000
From: Jarek Poplawski <jarkao2@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Martin Devera <devik@....cz>, Patrick McHardy <kaber@...sh.net>,
netdev@...r.kernel.org
Subject: [PATCH 5/6] pkt_sched: sch_htb: Optimize htb_find_next_upper()
htb_id_find_next_upper() is usually called to find a class with next
id after some previously removed class, so let's move a check for
equality to the end: it's the least likely here.
Signed-off-by: Jarek Poplawski <jarkao2@...il.com>
---
net/sched/sch_htb.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 2e0a74c..f44a4be 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -702,14 +702,14 @@ static struct rb_node *htb_id_find_next_upper(int prio, struct rb_node *n,
while (n) {
struct htb_class *cl =
rb_entry(n, struct htb_class, node[prio]);
- if (id == cl->common.classid)
- return n;
if (id > cl->common.classid) {
n = n->rb_right;
- } else {
+ } else if (id < cl->common.classid) {
r = n;
n = n->rb_left;
+ } else {
+ return n;
}
}
return r;
--
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists