From: Rusty Russell <rusty@rustcorp.com.au>
To: Mark McLoughlin <markmc@redhat.com>
Cc: linux-kernel@vger.kernel.org, virtualization@lists.osdl.org,
Herbert Xu <herbert.xu@redhat.com>
Subject: Re: [PATCH 2/2] virtio_net: Improve the recv buffer allocation scheme
Date: Thu, 9 Oct 2008 11:55:59 +1100 [thread overview]
Message-ID: <200810091155.59731.rusty@rustcorp.com.au> (raw)
In-Reply-To: <1223494499-18732-2-git-send-email-markmc@redhat.com>
On Thursday 09 October 2008 06:34:59 Mark McLoughlin wrote:
> From: Herbert Xu <herbert.xu@redhat.com>
>
> If segmentation offload is enabled by the host, we currently allocate
> maximum sized packet buffers and pass them to the host. This uses up
> 20 ring entries, allowing us to supply only 20 packet buffers to the
> host with a 256 entry ring. This is a huge overhead when receiving
> small packets, and is most keenly felt when receiving MTU sized
> packets from off-host.
Hi Mark!
There are three approaches we should investigate before adding YA feature.
Obviously, we can simply increase the number of ring entries.
Secondly, we can put the virtio_net_hdr at the head of the skb data (this is
also worth considering for xmit I think if we have headroom) and drop
MAX_SKB_FRAGS which contains a gratuitous +2.
Thirdly, we can try to coalesce contiguous buffers. The page caching scheme
we have might help here, I don't know. Maybe we should be explicitly trying
to allocate higher orders.
Now, that said, we might need this anyway. But let's try the easy things
first? (Or as well...)
> The size of the logical buffer is
> returned to the guest rather than the size of the individual smaller
> buffers.
That's a virtio transport breakage: can you use the standard virtio mechanism,
just put the extended length or number of extra buffers inside the
virtio_net_hdr?
That makes more sense to me.
> Make use of this support by supplying single page receive buffers to
> the host. On receive, we extract the virtio_net_hdr, copy 128 bytes of
> the payload to the skb's linear data buffer and adjust the fragment
> offset to point to the remaining data. This ensures proper alignment
> and allows us to not use any paged data for small packets. If the
> payload occupies multiple pages, we simply append those pages as
> fragments and free the associated skbs.
> + char *p = page_address(skb_shinfo(skb)->frags[0].page);
...
> + memcpy(hdr, p, sizeof(*hdr));
> + p += sizeof(*hdr);
I think you need kmap_atomic() here to access the page. And yes, that will
effect performance :(
A few more comments moved from the patch header into the source wouldn't go
astray, but I'm happy to do that myself (it's been on my TODO for a while).
Thanks!
Rusty.
next prev parent reply other threads:[~2008-10-09 0:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-08 19:34 [PATCH 1/2] virtio_net: Recycle some more rx buffer pages Mark McLoughlin
2008-10-08 19:34 ` [PATCH 2/2] virtio_net: Improve the recv buffer allocation scheme Mark McLoughlin
2008-10-09 0:55 ` Rusty Russell [this message]
2008-10-09 15:30 ` Herbert Xu
2008-10-09 17:40 ` Mark McLoughlin
2008-10-09 19:26 ` Anthony Liguori
2008-10-10 8:30 ` Mark McLoughlin
2008-10-16 9:15 ` Rusty Russell
2008-10-10 12:56 ` Mark McLoughlin
2008-10-16 4:43 ` Rusty Russell
2008-10-09 15:35 ` Chris Wright
2008-10-16 5:08 ` [PATCH 1/2] virtio_net: Recycle some more rx buffer pages Rusty Russell
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=200810091155.59731.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=herbert.xu@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markmc@redhat.com \
--cc=virtualization@lists.osdl.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).