| To: | "David S. Miller" <davem@xxxxxxxxxxxxx> |
|---|---|
| Subject: | [PATCH] loop unrolling in net/sched/sch_generic.c |
| From: | Eric Dumazet <dada1@xxxxxxxxxxxxx> |
| Date: | Tue, 05 Jul 2005 09:38:52 +0200 |
| Cc: | netdev@xxxxxxxxxxx |
| In-reply-to: | <20050704.160140.21591849.davem@xxxxxxxxxxxxx> |
| References: | <20050704.154712.63128211.davem@xxxxxxxxxxxxx> <42C9BE69.2070008@xxxxxxxxxxxxx> <42C9BEF6.4080402@xxxxxxxxxxxxx> <20050704.160140.21591849.davem@xxxxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | Mozilla Thunderbird 1.0 (Windows/20041206) |
[NET] : unroll a small loop in pfifo_fast_dequeue(). Compiler generates better
code.
(Using skb_queue_empty() to test the queue is faster than trying to
__skb_dequeue())
oprofile says this function uses now 0.29% instead of 1.22 %, on a
x86_64 target.
Signed-off-by: Eric Dumazet <dada1@xxxxxxxxxxxxx>
--- linux-2.6.12/net/sched/sch_generic.c 2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.12-ed/net/sched/sch_generic.c 2005-07-05 09:11:30.000000000
+0200
@@ -333,18 +333,23 @@
static struct sk_buff *
pfifo_fast_dequeue(struct Qdisc* qdisc)
{
- int prio;
struct sk_buff_head *list = qdisc_priv(qdisc);
struct sk_buff *skb;
- for (prio = 0; prio < 3; prio++, list++) {
- skb = __skb_dequeue(list);
- if (skb) {
- qdisc->q.qlen--;
- return skb;
- }
+ for (;;) {
+ if (!skb_queue_empty(list))
+ break;
+ list++;
+ if (!skb_queue_empty(list))
+ break;
+ list++;
+ if (!skb_queue_empty(list))
+ break;
+ return NULL;
}
- return NULL;
+ skb = __skb_dequeue(list);
+ qdisc->q.qlen--;
+ return skb;
}
static int
|
| Previous by Date: | Re: [TG3]: About hw coalescing infrastructure., David S. Miller |
|---|---|
| Next by Date: | Re: [PATCH] loop unrolling in net/sched/sch_generic.c, Thomas Graf |
| Previous by Thread: | Re: [TG3]: About hw coalescing infrastructure., David S. Miller |
| Next by Thread: | Re: [PATCH] loop unrolling in net/sched/sch_generic.c, Thomas Graf |
| Indexes: | [Date] [Thread] [Top] [All Lists] |