diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2008-12-09 22:34:40 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-09 22:34:40 -0800 |
commit | 1b5c0077e1615bb16e777a10ec1fc1195ba059ac (patch) | |
tree | 9f00035466fbdb8b41d360730bc0be99a91b1148 /net/sched/sch_htb.c | |
parent | dbb7a95d810ab76aac42e1a5cefdf069dcd014a1 (diff) | |
download | linux-1b5c0077e1615bb16e777a10ec1fc1195ba059ac.tar.gz linux-1b5c0077e1615bb16e777a10ec1fc1195ba059ac.tar.bz2 linux-1b5c0077e1615bb16e777a10ec1fc1195ba059ac.zip |
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/sch_htb.c')
-rw-r--r-- | 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 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, 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; |