From: "Michael S. Tsirkin" <mst@redhat.com>
To: Michael Dalton <mwdalton@google.com>
Cc: netdev@vger.kernel.org,
lf-virt <virtualization@lists.linux-foundation.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
Date: Thu, 9 Jan 2014 08:42:16 +0200 [thread overview]
Message-ID: <20140109064216.GA19559@redhat.com> (raw)
In-Reply-To: <CANJ5vP+_aK0PMc6-hwbu6PduVNDe8jbWR19cN5C+k4mWQzdTGg@mail.gmail.com>
On Wed, Jan 08, 2014 at 07:16:18PM -0800, Michael Dalton wrote:
> Hi Michael,
>
> On Wed, Jan 8, 2014 at 5:42 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > Sorry that I didn't notice early, but there seems to be a bug here.
> > See below.
> Yes, that is definitely a bug. Virtio spec permits OOO completions,
> but current code assumes in-order completion. Thanks for catching this.
>
> > Don't need full int really, it's up to 4K/cache line size,
> > 1 byte would be enough, maximum 2 ...
> > So if all we want is extra 1-2 bytes per buffer, we don't really
> > need this extra level of indirection I think.
> > We can just allocate them before the header together with an skb.
> I'm not sure if I'm parsing the above correctly, but do you mean using a
> few bytes at the beginning of the packet buffer to store truesize? I
> think that will break Jason's virtio-net RX frag coalescing
> code. To coalesce consecutive RX packet buffers, our packet buffers must
> be physically adjacent, and any extra bytes before the start of the
> buffer would break that.
>
> We could allocate an SKB per packet buffer, but if we have multi-buffer
> packets often(e.g., netperf benefiting from GSO/GRO), we would be
> allocating 1 SKB per packet buffer instead of 1 SKB per MAX_SKB_FRAGS
> buffers. How do you feel about any of the below alternatives:
>
> (1) Modify the existing mrg_buf_ctx to chain together free entries
> We can use the 'buf' pointer in mergeable_receive_buf_ctx to chain
> together free entries so that we can support OOO completions. This would
> be similar to how virtio-queue manages free sg entries.
>
> (2) Combine the buffer pointer and truesize into a single void* value
> Your point about there only being a byte needed to encode truesize is
> spot on, and I think we could leverage this to eliminate the out-of-band
> metadata ring entirely. If we were willing to change the packet buffer
> alignment from L1_CACHE_BYTES to 256 (or min (256, L1_CACHE_SIZE)),
I think you mean max here.
> we
> could encode the truesize in the least significant 8 bits of the buffer
> address (encoded as truesize >> 8 as we know all sizes are a multiple
> of 256). This would allow packet buffers up to 64KB in length.
>
> Is there another approach you would prefer to any of these? If the
> cleanliness issues and larger alignment aren't too bad, I think (2)
> sounds promising and allow us to eliminate the metadata ring
> entirely while still permitting RX frag coalescing.
>
> Best,
>
> Mike
I agree, this sounds like a better approach. It's certainly no worse than
current net-next code that always allocates about 1.5K,
and struct sk_buff itself is about 256 bytes on 64 bit.
--
MST
next prev parent reply other threads:[~2014-01-09 6:42 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 5:25 [PATCH net-next v2 1/4] net: allow > 0 order atomic page alloc in skb_page_frag_refill Michael Dalton
2014-01-07 5:25 ` [PATCH net-next v2 2/4] virtio-net: use per-receive queue page frag alloc for mergeable bufs Michael Dalton
2014-01-07 5:25 ` [PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance Michael Dalton
2014-01-08 6:23 ` Jason Wang
2014-01-08 18:28 ` Michael Dalton
2014-01-08 18:44 ` Eric Dumazet
2014-01-08 19:16 ` Michael S. Tsirkin
2014-01-08 19:56 ` Michael Dalton
2014-01-08 20:30 ` Michael S. Tsirkin
2014-01-09 1:42 ` Michael S. Tsirkin
2014-01-09 3:16 ` Michael Dalton
2014-01-09 3:41 ` Michael Dalton
2014-01-09 6:48 ` Michael S. Tsirkin
2014-01-09 8:28 ` Michael Dalton
2014-01-09 9:02 ` Michael Dalton
2014-01-09 13:25 ` Michael S. Tsirkin
2014-01-09 19:33 ` Michael Dalton
2014-01-09 6:42 ` Michael S. Tsirkin [this message]
2014-01-07 5:25 ` [PATCH net-next v2 4/4] virtio-net: initial debugfs support, export mergeable rx buffer size Michael Dalton
2014-01-08 6:34 ` Jason Wang
2014-01-08 19:21 ` Michael S. Tsirkin
2014-01-11 5:19 ` Michael Dalton
2014-01-11 5:36 ` Michael Dalton
2014-01-12 17:09 ` Michael S. Tsirkin
2014-01-12 23:32 ` Michael Dalton
2014-01-13 7:36 ` Jason Wang
2014-01-13 9:40 ` Michael S. Tsirkin
2014-01-13 15:38 ` Ben Hutchings
2014-01-13 19:07 ` Michael Dalton
2014-01-13 19:19 ` Michael Dalton
2014-01-14 21:45 ` Michael Dalton
2014-01-14 21:53 ` Michael S. Tsirkin
2014-01-08 18:24 ` Michael S. Tsirkin
2014-01-08 18:08 ` [PATCH net-next v2 1/4] net: allow > 0 order atomic page alloc in skb_page_frag_refill Michael S. Tsirkin
2014-01-08 18:26 ` Eric Dumazet
2014-01-08 19:18 ` Michael S. Tsirkin
2014-01-08 19:46 ` Eric Dumazet
2014-01-08 21:54 ` Debabrata Banerjee
2014-01-08 22:01 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140109064216.GA19559@redhat.com \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=mwdalton@google.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).