The current call to __qdisc_dequeue_head leads to a branch
misprediction for every loop iteration, the fact that the
most common priority is 2 makes this even worse.  This issue
has been brought up by Eric Dumazet <[EMAIL PROTECTED]>
but unlike his solution which was to manually unroll the loop,
this approach preserves the possibility to increase the number
of bands at compile time. 

Signed-off-by: Thomas Graf <[EMAIL PROTECTED]>

Index: net-2.6/net/sched/sch_generic.c
===================================================================
--- net-2.6.orig/net/sched/sch_generic.c        2005-07-06 15:26:47.000000000 
+0200
+++ net-2.6/net/sched/sch_generic.c     2005-07-17 20:27:56.000000000 +0200
@@ -331,11 +331,10 @@
        int prio;
        struct sk_buff_head *list = qdisc_priv(qdisc);
 
-       for (prio = 0; prio < PFIFO_FAST_BANDS; prio++, list++) {
-               struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list);
-               if (skb) {
+       for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
+               if (!skb_queue_empty(list + prio)) {
                        qdisc->q.qlen--;
-                       return skb;
+                       return __qdisc_dequeue_head(qdisc, list + prio);
                }
        }
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to