[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <k2n65634d661004211623k3ce51c95o2c329529ce402eda@mail.gmail.com>
Date: Wed, 21 Apr 2010 16:23:05 -0700
From: Tom Herbert <therbert@...gle.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Changli Gao <xiaosuo@...il.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
jamal <hadi@...erus.ca>
Subject: Re: [PATCH v3] net: batch skb dequeueing from softnet input_pkt_queue
> do {
> - struct sk_buff *skb;
> + lim = quota - work;
> + if (lim > ARRAY_SIZE(sd->batch))
> + lim = ARRAY_SIZE(sd->batch);
> + /* batch at most 16 buffers */
>
How about just using two input_pkt_queue's (define
input_pkt_queue[2])? One that is used to enqueue from RPS, and one
that is being processed by process_backlog. Then the only thing that
needs to be done under lock in process_backlog is to switch the
queues; something like sd->current_input_pkt_queue ^= 1
Tom
> - local_irq_disable();
> rps_lock(sd);
> - skb = __skb_dequeue(&sd->input_pkt_queue);
> - if (!skb) {
> + for (n = 0; n < lim; n++) {
> + sd->batch[n] = __skb_dequeue(&sd->input_pkt_queue);
> + if (!sd->batch[n])
> + break;
> + }
> + if (!sd->input_pkt_queue.qlen) {
> __napi_complete(napi);
> - rps_unlock(sd);
> - local_irq_enable();
> - break;
> + quota = 0;
> }
> - input_queue_head_incr(sd);
> rps_unlock(sd);
> - local_irq_enable();
>
> - __netif_receive_skb(skb);
> - } while (++work < quota);
> + /* Now process our batch */
> + for (i = 0; i < n; i++) {
> + skb = sd->batch[i];
> + /* flush_backlog() might have stolen this skb */
> + input_queue_head_incr(sd);
> + if (likely(skb)) {
> + sd->batch[i] = NULL;
> + local_irq_enable();
> + __netif_receive_skb(skb);
> + local_irq_disable();
> + }
> + }
> + work += n;
> + } while (work < quota);
>
> + local_irq_enable();
> return work;
> }
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists