From mboxrd@z Thu Jan 1 00:00:00 1970 From: Qin Chuanyu Subject: Re: [PATCH] virtio: make udp more efficient by avoiding indirect desc Date: Mon, 3 Mar 2014 19:22:56 +0800 Message-ID: <53146610.5080901@huawei.com> References: <52FA3AAC.2050003@huawei.com> <20140211154308.GA467@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , KVM list To: "Michael S. Tsirkin" Return-path: Received: from szxga03-in.huawei.com ([119.145.14.66]:53153 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753566AbaCCLZR (ORCPT ); Mon, 3 Mar 2014 06:25:17 -0500 In-Reply-To: <20140211154308.GA467@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2014/2/11 23:43, Michael S. Tsirkin wrote: > 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. > I have found that there are related patch in Qemu, Is there patch suit for vhost_net right now, Or should I implement it myself ? >> 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 > > 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 > >