Commit 512bb43e authored by Jarek Poplawski's avatar Jarek Poplawski Committed by David S. Miller

pkt_sched: sch_htb: Optimize WARN_ONs in htb_dequeue_tree() etc.

We can skip WARN_ON() in htb_dequeue_tree() because there should be
always a similar warning from htb_lookup_leaf() earlier.

The first WARN_ON() in in htb_lookup_leaf() is changed to BUG_ON()
because most likly this should end with oops anyway.
Signed-off-by: default avatarJarek Poplawski <jarkao2@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1b5c0077
...@@ -726,7 +726,7 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio, ...@@ -726,7 +726,7 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio,
u32 *pid; u32 *pid;
} stk[TC_HTB_MAXDEPTH], *sp = stk; } stk[TC_HTB_MAXDEPTH], *sp = stk;
WARN_ON(!tree->rb_node); BUG_ON(!tree->rb_node);
sp->root = tree->rb_node; sp->root = tree->rb_node;
sp->pptr = pptr; sp->pptr = pptr;
sp->pid = pid; sp->pid = pid;
...@@ -746,9 +746,10 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio, ...@@ -746,9 +746,10 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio,
*sp->pptr = (*sp->pptr)->rb_left; *sp->pptr = (*sp->pptr)->rb_left;
if (sp > stk) { if (sp > stk) {
sp--; sp--;
WARN_ON(!*sp->pptr); if (!*sp->pptr) {
if (!*sp->pptr) WARN_ON(1);
return NULL; return NULL;
}
htb_next_rb_node(sp->pptr); htb_next_rb_node(sp->pptr);
} }
} else { } else {
...@@ -779,8 +780,7 @@ static struct sk_buff *htb_dequeue_tree(struct htb_sched *q, int prio, ...@@ -779,8 +780,7 @@ static struct sk_buff *htb_dequeue_tree(struct htb_sched *q, int prio,
do { do {
next: next:
WARN_ON(!cl); if (unlikely(!cl))
if (!cl)
return NULL; return NULL;
/* class can be empty - it is unlikely but can be true if leaf /* class can be empty - it is unlikely but can be true if leaf
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment