Skip to content

Commit

Permalink
pkt_sched: sch_htb: Optimize htb_find_next_upper()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Dec 10, 2008
1 parent dbb7a95 commit 1b5c007
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1b5c007

Please sign in to comment.