aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-07-18 16:30:53 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-18 16:30:53 -0400
commit452f299da3253f65020143f743c2e207b752547b (patch)
tree56f02114d9e65d60c0f3a0658602e7e193f226bd /net/sched
parentd7c7ed4dbc66c5f4dfa5615cdfc5009af3b3b137 (diff)
[PKT_SCHED]: Reduce branch mispredictions in pfifo_fast_dequeue
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 <dada1@cosmosbay.com> 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 <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/sch_generic.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 73e218e646ac..8edefd5d095d 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -331,11 +331,10 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc)
331 int prio; 331 int prio;
332 struct sk_buff_head *list = qdisc_priv(qdisc); 332 struct sk_buff_head *list = qdisc_priv(qdisc);
333 333
334 for (prio = 0; prio < PFIFO_FAST_BANDS; prio++, list++) { 334 for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
335 struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list); 335 if (!skb_queue_empty(list + prio)) {
336 if (skb) {
337 qdisc->q.qlen--; 336 qdisc->q.qlen--;
338 return skb; 337 return __qdisc_dequeue_head(qdisc, list + prio);
339 } 338 }
340 } 339 }
341 340