From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750993AbdHRHhP (ORCPT ); Fri, 18 Aug 2017 03:37:15 -0400 Received: from mga05.intel.com ([192.55.52.43]:47878 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbdHRHhN (ORCPT ); Fri, 18 Aug 2017 03:37:13 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,391,1498546800"; d="scan'208";a="125073796" Message-ID: <599699AF.1090705@intel.com> Date: Fri, 18 Aug 2017 15:39:27 +0800 From: Wei Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Michael S. Tsirkin" CC: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, mhocko@kernel.org, akpm@linux-foundation.org, mawilcox@microsoft.com, david@redhat.com, cornelia.huck@de.ibm.com, mgorman@techsingularity.net, aarcange@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, willy@infradead.org, liliang.opensource@gmail.com, yang.zhang.wz@gmail.com, quan.xu@aliyun.com Subject: Re: [PATCH v14 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG References: <1502940416-42944-1-git-send-email-wei.w.wang@intel.com> <1502940416-42944-4-git-send-email-wei.w.wang@intel.com> <20170818051451-mutt-send-email-mst@kernel.org> In-Reply-To: <20170818051451-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/18/2017 10:22 AM, Michael S. Tsirkin wrote: > +static void send_balloon_page_sg(struct virtio_balloon *vb, > + struct virtqueue *vq, > + void *addr, > + uint32_t size) > +{ > + unsigned int len; > + int ret; > + > + do { > + ret = add_one_sg(vq, addr, size); > + virtqueue_kick(vq); > + wait_event(vb->acked, virtqueue_get_buf(vq, &len)); > + /* > + * It is uncommon to see the vq is full, because the sg is sent > + * one by one and the device is able to handle it in time. But > + * if that happens, we go back to retry after an entry gets > + * released. > + */ > Why send one by one though? Why not batch some s/gs and wait for all > of them to be completed? If memory if fragmented, waiting every time is > worse than what we have now (VIRTIO_BALLOON_ARRAY_PFNS_MAX at a time). > OK, I'll do batching in some fashion. Best, Wei