kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Qin Chuanyu <qinchuanyu@huawei.com>
Cc: rusty@rustcorp.com.au, jasowang@redhat.com,
	KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH] virtio: make udp more efficient by avoiding indirect desc
Date: Tue, 11 Feb 2014 17:43:08 +0200	[thread overview]
Message-ID: <20140211154308.GA467@redhat.com> (raw)
In-Reply-To: <52FA3AAC.2050003@huawei.com>

On Tue, Feb 11, 2014 at 10:58:52PM +0800, Qin Chuanyu wrote:
> udp packet use 2 buffers at least, one for vnet_hdr and
> one for skb->data.

Not really, we use 1 buffer now with vnet_hdr inline with data.

> we could change the threshold from 2 to 3, so the udp packet
> which data buff only using single desc will gain from this.
> the guest would avoid from allocating memory dynamically.
> the host would avoid from translating indirect desc.
> 
> Signed-off-by: Chuanyu Qin <qinchuanyu@huawei.com>

Optimization patch without any performance data?
Such a change would need much more testing than that:
would have to try various workloads with -net and -blk at least.

> ---
>  drivers/virtio/virtio_ring.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 28b5338..88d008f 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -220,7 +220,7 @@ static inline int virtqueue_add(struct virtqueue *_vq,
> 
>  	/* If the host supports indirect descriptor tables, and we have multiple
>  	 * buffers, then go indirect. FIXME: tune this threshold */
> -	if (vq->indirect && total_sg > 1 && vq->vq.num_free) {
> +	if (vq->indirect && total_sg > 2 && vq->vq.num_free) {
>  		head = vring_add_indirect(vq, sgs, next, total_sg, total_out,
>  					  total_in,
>  					  out_sgs, in_sgs, gfp);
> -- 
> 1.7.3.1.msysgit.0

  reply	other threads:[~2014-02-11 15:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 14:58 [PATCH] virtio: make udp more efficient by avoiding indirect desc Qin Chuanyu
2014-02-11 15:43 ` Michael S. Tsirkin [this message]
2014-02-12  1:51   ` Qin Chuanyu
2014-02-12  8:59   ` Paolo Bonzini
2014-03-03 11:22   ` Qin Chuanyu
2014-02-13  2:57 ` 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=20140211154308.GA467@redhat.com \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=qinchuanyu@huawei.com \
    --cc=rusty@rustcorp.com.au \
    /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).