Re: [PATCH] loop unrolling in net/sched/sch_generic.c
From: Thomas Graf <tgraf@suug.ch>
Date: 2005-07-06 00:51:40
From: Thomas Graf <tgraf@suug.ch>
Date: 2005-07-06 00:51:40
* Eric Dumazet [ref] 2005-07-06 02:32
Hum... shouldnt it be : + skb = __qdisc_dequeue_head(qdisc, list + prio);
Correct.
Anyway, the branches misprediction come from the fact that most of packets are queued in the prio=2 list. So each time this function is called, a non unrolled version has to pay 2 to 5 branches misprediction. if ((!skb_queue_empty(list + prio)) /* branch not taken, mispredict when prio=0 */
The !expr implies an unlikely so the prediction should be right and equal to your unrolling version.
Maybe we can rewrite the whole thing without branches, examining prio from PFIFO_FAST_BANDS-1 down to 0, at least for modern cpu with conditional mov (cmov)
This would break the whole thing, the qdisc is supposed to try and dequeue from the highest priority queue (prio=0) first.