[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878vbn2ify.fsf@rustcorp.com.au>
Date: Thu, 04 Oct 2012 09:54:01 +0930
From: Rusty Russell <rusty@...tcorp.com.au>
To: "Michael S. Tsirkin" <mst@...hat.com>,
Thomas Lendacky <tahm@...ux.vnet.ibm.com>
Cc: Sasha Levin <levinsasha928@...il.com>,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org, avi@...hat.com, kvm@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 2/3] virtio-net: correct capacity math on ring full
"Michael S. Tsirkin" <mst@...hat.com> writes:
> Capacity math on ring full is wrong: we are
> looking at num_sg but that might be optimistic
> because of indirect buffer use.
>
> The implementation also penalizes fast path
> with extra memory accesses for the benefit of
> ring full condition handling which is slow path.
>
> It's easy to query ring capacity so let's do just that.
This path will reduce the actual queue use to worst-case assumptions.
With bufferbloat maybe that's a good thing, but it's true.
If we do this, the code is now wrong:
/* This can happen with OOM and indirect buffers. */
if (unlikely(capacity < 0)) {
Because this should now *never* happen.
But I do like the cleanup; returning capacity from add_buf() was always
hacky. I've got an idea, we'll see what it looks like...
Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists