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

udp packet use 2 buffers at least, one for vnet_hdr and
one for skb->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>
---
  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 14:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 14:58 Qin Chuanyu [this message]
2014-02-11 15:43 ` [PATCH] virtio: make udp more efficient by avoiding indirect desc Michael S. Tsirkin
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=52FA3AAC.2050003@huawei.com \
    --to=qinchuanyu@huawei.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.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).