aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2008-12-10 01:34:40 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-10 01:34:40 -0500
commit1b5c0077e1615bb16e777a10ec1fc1195ba059ac (patch)
tree9f00035466fbdb8b41d360730bc0be99a91b1148 /net/sched
parentdbb7a95d810ab76aac42e1a5cefdf069dcd014a1 (diff)
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@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/sch_htb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index f89fd71ce92f..b820a0ae7355 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -698,14 +698,14 @@ static struct rb_node *htb_id_find_next_upper(int prio, struct rb_node *n,
698 while (n) { 698 while (n) {
699 struct htb_class *cl = 699 struct htb_class *cl =
700 rb_entry(n, struct htb_class, node[prio]); 700 rb_entry(n, struct htb_class, node[prio]);
701 if (id == cl->common.classid)
702 return n;
703 701
704 if (id > cl->common.classid) { 702 if (id > cl->common.classid) {
705 n = n->rb_right; 703 n = n->rb_right;
706 } else { 704 } else if (id < cl->common.classid) {
707 r = n; 705 r = n;
708 n = n->rb_left; 706 n = n->rb_left;
707 } else {
708 return n;
709 } 709 }
710 } 710 }
711 return r; 711 return r;