Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1637019

RE: [PATCH v10 3/6] virtio-balloon: VIRTIO_BALLOON_F_PAGE_CHUNKS

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From "Wang, Wei W" <wei.w.wang@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH v10 3/6] virtio-balloon: VIRTIO_BALLOON_F_PAGE_CHUNKS
Date Sun, 07 May 2017 23:50:02 +0200
Message-ID <tECdY-30b-27@gated-at.bofh.it> (permalink)
References <tDkM9-15Z-3@gated-at.bofh.it> <tDkMa-15Z-29@gated-at.bofh.it> <tDTTz-7R3-1@gated-at.bofh.it>
X-Original-To "Michael S. Tsirkin" <mst@redhat.com>
X-Extloop1 1
X-Ironport-Av E=Sophos;i="5.38,302,1491289200"; d="scan'208";a="1165644932"
Thread-Topic [PATCH v10 3/6] virtio-balloon: VIRTIO_BALLOON_F_PAGE_CHUNKS
Thread-Index AQHSxe8R2vL7EIsrz0GIzbzsKsMw9qHoM7RA
Accept-Language en-US
Content-Language en-US
X-Titus-Metadata-40 eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWJiOTdmNjItNTQzMC00ZTUxLWE4ZTItNDkwN2M2Njg5ZWFhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNS45LjYuNiIsIlRydXN0ZWRMYWJlbEhhc2giOiJpQTZDNXd5QThCWnBZWld3ZGtcL0dGQ1QzY2ZaRmhmRUtBeDNvVWJMd05EUT0ifQ==
X-Ctpclassification CTP_PUBLIC
Dlp-Product dlpe-windows
Dlp-Version 10.0.102.7
Dlp-Reaction no-action
X-Originating-IP [10.239.127.40]
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding 8BIT
MIME-Version 1.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc "virtio-dev@lists.oasis-open.org" <virtio-dev@lists.oasis-open.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>, "virtualization@lists.linux-foundation.org" <virtualization@lists.linux-foundation.org>, "kvm@vger.kernel.org" <kvm@vger.kernel.org>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "david@redhat.com" <david@redhat.com>, "Hansen, Dave" <dave.hansen@intel.com>, "cornelia.huck@de.ibm.com" <cornelia.huck@de.ibm.com>, "akpm@linux-foundation.org" <akpm@linux-foundation.org>, "mgorman@techsingularity.net" <mgorman@techsingularity.net>, "aarcange@redhat.com" <aarcange@redhat.com>, "amit.shah@redhat.com" <amit.shah@redhat.com>, "pbonzini@redhat.com" <pbonzini@redhat.com>, "liliang.opensource@gmail.com" <liliang.opensource@gmail.com>
X-Original-Date Sun, 7 May 2017 04:22:46 +0000
X-Original-Message-ID <286AC319A985734F985F78AFA26841F7391FFBE8@shsmsx102.ccr.corp.intel.com>
X-Original-References <1493887815-6070-1-git-send-email-wei.w.wang@intel.com> <1493887815-6070-4-git-send-email-wei.w.wang@intel.com> <20170506012146-mutt-send-email-mst@kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1637019

Show key headers only | View raw


On 05/06/2017 06:29 AM, Michael S. Tsirkin wrote:
> On Thu, May 04, 2017 at 04:50:12PM +0800, Wei Wang wrote:
> > Add a new feature, VIRTIO_BALLOON_F_PAGE_CHUNKS, which enables the
> > transfer of the ballooned (i.e. inflated/deflated) pages in chunks to
> > the host.
> >
> > The implementation of the previous virtio-balloon is not very
> > efficient, because the ballooned pages are transferred to the host one
> > by one. Here is the breakdown of the time in percentage spent on each
> > step of the balloon inflating process (inflating 7GB of an 8GB idle
> > guest).
> >
> > 1) allocating pages (6.5%)
> > 2) sending PFNs to host (68.3%)
> > 3) address translation (6.1%)
> > 4) madvise (19%)
> >
> > It takes about 4126ms for the inflating process to complete.
> > The above profiling shows that the bottlenecks are stage 2) and stage
> > 4).
> >
> > This patch optimizes step 2) by transferring pages to the host in
> > chunks. A chunk consists of guest physically continuous pages.
> > When the pages are packed into a chunk, they are converted into
> > balloon page size (4KB) pages. A chunk is offered to the host via a
> > base PFN (i.e. the start PFN of those physically continuous
> > pages) and the size (i.e. the total number of the 4KB balloon size
> > pages). A chunk is formatted as below:
> > --------------------------------------------------------
> > |                 Base (52 bit)        | Rsvd (12 bit) |
> > --------------------------------------------------------
> > --------------------------------------------------------
> > |                 Size (52 bit)        | Rsvd (12 bit) |
> > --------------------------------------------------------
> >
> > By doing so, step 4) can also be optimized by doing address
> > translation and madvise() in chunks rather than page by page.
> >
> > With this new feature, the above ballooning process takes ~590ms
> > resulting in an improvement of ~85%.
> >
> > TODO: optimize stage 1) by allocating/freeing a chunk of pages instead
> > of a single page each time.
> >
> > Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> > Signed-off-by: Liang Li <liang.z.li@intel.com>
> > Suggested-by: Michael S. Tsirkin <mst@redhat.com>
> 
> 
> This is much cleaner, thanks. It might be even better to have wrappers that put
> array and its size in a struct and manage that struct, but I won't require this for
> submission.

OK, thanks. Would this be your suggestion:

struct virtio_balloon_page_struct { 
	unsigned int page_bmap_num;
	unsigned long *page_bmap[VIRTIO_BALLOON_PAGE_BMAP_MAX_NUM];
}

Best,
Wei

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v10 0/6] Extend virtio-balloon for fast (de)inflating & fast live migration Wei Wang <wei.w.wang@intel.com> - 2017-05-04 11:00 +0200
  [PATCH v10 5/6] mm: export symbol of next_zone and first_online_pgdat Wei Wang <wei.w.wang@intel.com> - 2017-05-04 11:00 +0200
  [PATCH v10 3/6] virtio-balloon: VIRTIO_BALLOON_F_PAGE_CHUNKS Wei Wang <wei.w.wang@intel.com> - 2017-05-04 11:00 +0200
    Re: [PATCH v10 3/6] virtio-balloon: VIRTIO_BALLOON_F_PAGE_CHUNKS "Michael S. Tsirkin" <mst@redhat.com> - 2017-05-06 00:30 +0200
      RE: [PATCH v10 3/6] virtio-balloon: VIRTIO_BALLOON_F_PAGE_CHUNKS "Wang, Wei W" <wei.w.wang@intel.com> - 2017-05-07 23:50 +0200

csiph-web