qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Li, Liang Z" <liang.z.li@intel.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"mst@redhat.com" <mst@redhat.com>,
	"lcapitulino@redhat.com" <lcapitulino@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"quintela@redhat.com" <quintela@redhat.com>,
	"amit.shah@redhat.com" <amit.shah@redhat.com>,
	"dgilbert@redhat.com" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [QEMU 1/7] balloon: speed up inflating & deflating process
Date: Tue, 14 Jun 2016 17:33:17 +0200	[thread overview]
Message-ID: <576023BD.1040700@redhat.com> (raw)
In-Reply-To: <F2CBF3009FA73547804AE4C663CAB28E041ED9AD@shsmsx102.ccr.corp.intel.com>

On 14.06.2016 16:41, Li, Liang Z wrote:
>>> On 13.06.2016 12:16, Liang Li wrote:
>>>> The implementation of the current virtio-balloon is not very
>>>> efficient, Bellow is test result of time spends on inflating the
>>>> balloon to 3GB of a 4GB idle guest:
>>>>
>>>> a. allocating pages (6.5%, 103ms)
>>>> b. sending PFNs to host (68.3%, 787ms) c. address translation (6.1%,
>>>> 96ms) d. madvise (19%, 300ms)
>>>>
>>>> It takes about 1577ms for the whole inflating process to complete.
>>>> The test shows that the bottle neck is the stage b and stage d.
>>>>
>>>> If using a bitmap to send the page info instead of the PFNs, we can
>>>> reduce the overhead spends on stage b quite a lot. Furthermore, it's
>>>> possible to do the address translation and do the madvise with a
>>>> bulk of pages, instead of the current page per page way, so the
>>>> overhead of stage c and stage d can also be reduced a lot.
>>>>
>>>> This patch is the QEMU side implementation which is intended to
>>>> speed up the inflating & deflating process by adding a new feature
>>>> to the virtio-balloon device. And now, inflating the balloon to 3GB
>>>> of a 4GB idle guest only takes 210ms, it's about 8 times as fast as before.
[...]
>>>> +            chunk = TARGET_PAGE_SIZE;
>>>> +        }
>>>> +    }
>>>> +}
>>>> +
>>>> +static void balloon_bulk_pages(ram_addr_t base_pfn, unsigned long
>>> *bitmap,
>>>> +                               unsigned long len, int page_shift,
>>>> +bool deflate) { #if defined(__linux__)
>>>
>>> Why do you need this #if here?
>>>
>> Ooh,  it is wrong to add the '#if' here, will remove.
>>
> No, it is needed, just follow the code in balloon_page().
> only Linux support the madvise().

I think it is not needed anymore today and the #if in balloon_page could
be removed, too: As far as I can see, the #if there is from the early
days, when there was no wrapper around madvise() yet. But nowadays,
we've got the qemu_madvise() wrapper which takes care of either using
madvise(), posix_madvise() or doing nothing, so the virtio-balloon code
should be able to work without the #if now.

 Thomas

  reply	other threads:[~2016-06-14 15:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 10:16 [Qemu-devel] [QEMU 0/7] Fast balloon and fast live migration Liang Li
2016-06-13 10:16 ` [Qemu-devel] [QEMU 1/7] balloon: speed up inflating & deflating process Liang Li
2016-06-14 11:37   ` Thomas Huth
2016-06-14 14:22     ` Li, Liang Z
2016-06-14 14:41       ` Li, Liang Z
2016-06-14 15:33         ` Thomas Huth [this message]
2016-06-17  0:54           ` Li, Liang Z
2016-06-19  4:12   ` Michael S. Tsirkin
2016-06-20  1:37     ` Li, Liang Z
2016-06-13 10:16 ` [Qemu-devel] [QEMU 2/7] virtio-balloon: add drop cache support Liang Li
2016-06-19  4:14   ` Michael S. Tsirkin
2016-06-20  2:09     ` Li, Liang Z
2016-06-13 10:16 ` [Qemu-devel] [QEMU 3/7] Add the hmp and qmp interface for dropping cache Liang Li
2016-06-13 10:50   ` Daniel P. Berrange
2016-06-13 11:06     ` Daniel P. Berrange
2016-06-13 14:12       ` Li, Liang Z
2016-06-13 11:41     ` Paolo Bonzini
2016-06-13 14:14       ` Li, Liang Z
2016-06-13 13:50     ` Li, Liang Z
2016-06-13 15:09       ` Dr. David Alan Gilbert
2016-06-14  1:15         ` Li, Liang Z
2016-06-17  1:35         ` Li, Liang Z
2016-06-13 10:16 ` [Qemu-devel] [QEMU 4/7] balloon: get free page info from guest Liang Li
2016-06-19  4:24   ` Michael S. Tsirkin
2016-06-20  2:48     ` Li, Liang Z
2016-06-13 10:16 ` [Qemu-devel] [QEMU 5/7] bitmap: Add a new bitmap_move function Liang Li
2016-06-13 10:16 ` [Qemu-devel] [QEMU 6/7] kvm: Add two new arch specific functions Liang Li
2016-06-19  4:27   ` Michael S. Tsirkin
2016-06-20  3:16     ` Li, Liang Z
2016-06-13 10:16 ` [Qemu-devel] [QEMU 7/7] migration: skip free pages during live migration Liang Li
2016-06-19  4:43   ` Michael S. Tsirkin
2016-06-20  2:52     ` Li, Liang Z

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=576023BD.1040700@redhat.com \
    --to=thuth@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lcapitulino@redhat.com \
    --cc=liang.z.li@intel.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).