Re: [PATCH net-next] tuntap: introduce tx skb ring

From: Michael S. Tsirkin
Date: Wed May 18 2016 - 04:22:13 EST


On Wed, May 18, 2016 at 10:16:31AM +0200, Jesper Dangaard Brouer wrote:
>
> On Tue, 17 May 2016 09:38:37 +0800 Jason Wang <jasowang@xxxxxxxxxx> wrote:
>
> > >> And if tx_queue_length is not power of 2,
> > >> we probably need modulus to calculate the capacity.
> > > Is that really that important for speed?
> >
> > Not sure, I can test.
>
> In my experience, yes, adding a modulus does affect performance.

How about simple
if (unlikely(++idx > size))
idx = 0;


> >
> > Right, this sounds a good solution.
>
> Good idea.

I'm not that sure - it's clearly wasting memory.

> --
> Best regards,
> Jesper Dangaard Brouer
> MSc.CS, Principal Kernel Engineer at Red Hat
> Author of http://www.iptv-analyzer.org
> LinkedIn: http://www.linkedin.com/in/brouer