From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932892AbcETLT6 (ORCPT ); Fri, 20 May 2016 07:19:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45658 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932514AbcETLT4 (ORCPT ); Fri, 20 May 2016 07:19:56 -0400 Subject: Re: [PATCH RFC kernel] balloon: speed up inflating/deflating process To: Liang Li , mst@redhat.com References: <1463738386-30868-1-git-send-email-liang.z.li@intel.com> Cc: linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, akpm@linux-foundation.org, dgilbert@redhat.com, amit.shah@redhat.com, kvm@vger.kernel.org From: Paolo Bonzini Message-ID: <3e47bf87-3e9d-f836-021b-8a90919f9002@redhat.com> Date: Fri, 20 May 2016 13:19:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1463738386-30868-1-git-send-email-liang.z.li@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 20 May 2016 11:19:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/05/2016 11:59, Liang Li wrote: > + > + sg_init_table(sg, 5); > + sg_set_buf(&sg[0], &flags, sizeof(flags)); > + sg_set_buf(&sg[1], &start_pfn, sizeof(start_pfn)); > + sg_set_buf(&sg[2], &page_shift, sizeof(page_shift)); > + sg_set_buf(&sg[3], &bmap_len, sizeof(bmap_len)); These four should probably be placed in a single struct and therefore a single sg entry. It might even be faster to place it together with the bitmap, thus avoiding the use of indirect descriptors. You should also test ballooning of a 64GB guest after filling in the page cache, not just ballooning of a freshly booted 4GB guest. This will give you a much more sparse bitmap. Still, the improvement in sending PFNs to the host are impressive. Thanks, Paolo > + sg_set_buf(&sg[4], vb->page_bitmap + > + (start_pfn / BITS_PER_LONG), bmap_len); > + virtqueue_add_outbuf(vq, sg, 5, vb, GFP_KERNEL);