All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>, David Vrabel <david.vrabel@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Dario Faggioli <dario.faggioli@citrix.com>,
	xen-devel@lists.xen.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: Linux Xen Balloon Driver Improvement (Draft 2)
Date: Mon, 27 Oct 2014 17:29:16 +0000	[thread overview]
Message-ID: <544E80EC.5090808@citrix.com> (raw)
In-Reply-To: <20141027162907.GA13212@zion.uk.xensource.com>

On 27/10/14 16:29, Wei Liu wrote:
> On Mon, Oct 27, 2014 at 02:23:22PM +0000, David Vrabel wrote:
>> On 27/10/14 12:33, Wei Liu wrote:
>>>
>>> Changes in this version:
>>>
>>> 1. Style, grammar and typo fixes.
>>> 2. Make this document Linux centric.
>>> 3. Add a new section for NUMA-aware ballooning.
>>
>> You've not included the required changes to the toolstack and
>> autoballoon driver to always use 2M multiples when creating VMs and
>> setting targets.
>>
> 
> When creating VM, toolstack already tries to use as many huge pages as
> possible.
> 
> Setting target doesn't use 2M multiples.  But I don't think this is
> necessary. To balloon in / out X MB memory
> 
>   nr_2m = X % 2M
>   nr_4k = (X / 2M) / 4k
> 
> The remainder just goes to 4K queue.

I understand that it will work with 4k multiples but it is not /optimal/
to do so since it will result in more fragmentation.

> And what do you mean by "autoballoon" driver? Do you mean functionality
> of xl? In the end the request is still fulfilled by Xen balloon driver
> in kernel. So if dom0 is using the new balloon driver proposed here, it
> should balloon down in 2M multiples automatically.

Both xl and the auto-balloon driver in the kernel should only set the
target in multiples of 2M.

>>> ## Goal of improvement
>>>
>>> The balloon driver makes use of as many huge pages as possible,
>>> defragmenting guest address space. Contiguous guest address space
>>> permits huge page ballooning which helps prevent host address space
>>> fragmentation.
>>>
>>> This should be achieved without any particular hypervisor side
>>> feature.
>>
>> I really think you need to be taking whole-system view and not focusing
>> on just the guest balloon driver.
>>
> 
> I don't think there's terribly tight linkage between hypervisor side
> change and guest side change.

I don't see how you can think this unless you also have a design for the
hypervisor side.

I do not want a situation were effective and efficient host
defragmentation requires balloon driver changes to avoid a regression.

> To have guest automatically defragmenting it's address space while at
> the same time helps prevent hypervisor memory from fragmenting (at least
> this is what the design aims for, as for how it works in practice, it
> needs to be prototyped and benchmarked).
> 
> The above reasoning is good enough to justify this change, isn't it?

Having a whole system design does not mean that it must be all
implemented.  If one part has benefits independently from the rest then
it can be implemented and merged.

>>> ### Make use of balloon page compaction
>>>
>>> The core of migration callback is XENMEM\_exchange hypercall. This
>>> makes sure that inflation of old page and deflation of new page is
>>> done atomically, so even if a domain is beyond its memory target and
>>> the target is being enforced, it can still compact memory.
>>
>> Having looked at what XENMEM_exchange actually does, I can't see how
>> you're using it to give this behaviour.

Never mind.  I misread the docs.

>>> ### Periodically exchange normal size pages with huge pages
>>>
>>> Worker thread wakes up periodically to check if there are enough pages
>>> in normal size page queue to coalesce into a huge page. If so, it will
>>> try to exchange that huge page into a number of normal size pages with
>>> XENMEM\_exchange hypercall.
>>
>> I don't see what this is supposed to achieve.  This is going to take a
>> (potentially) non-fragmented superpage and fragment it.
>>
> 
> Let's look at this from start of day.
> 
> Guest always tries to balloon in / out as many 2M pages as possible. So
> if we have a long list of 4K pages, it means the underlying host super
> frames are fragmented already.
> 
> So if 1) there are enough 4K pages in ballooned out list, 2) there is a
> spare 2M page, it means that the 2M page comes from the result of
> balloon page compaction, which means the underlying host super frame is
> fragmented.

This assumption is only true because your page migration isn't trying
hard enough to defragment super frames, and it is assuming that Xen does
nothing to address host super frame fragmentation.  This highlights the
importance of looking at a system-level for designs, IMO.

David

  reply	other threads:[~2014-10-27 17:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 12:33 Linux Xen Balloon Driver Improvement (Draft 2) Wei Liu
2014-10-27 14:23 ` David Vrabel
2014-10-27 16:29   ` Wei Liu
2014-10-27 17:29     ` David Vrabel [this message]
2014-10-27 19:10       ` Wei Liu
2014-10-27 19:42         ` Stefano Stabellini
2014-10-27 19:14       ` Wei Liu
2014-10-28 10:51         ` David Vrabel
2014-10-29 11:01           ` Wei Liu
2014-12-15 10:52 ` David Vrabel
2014-12-15 10:58   ` Wei Liu

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=544E80EC.5090808@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dario.faggioli@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.