All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org, David Vrabel <david.vrabel@citrix.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: Xen balloon driver improvement (version 1)
Date: Thu, 23 Oct 2014 17:57:20 +0200	[thread overview]
Message-ID: <54492560.50402@citrix.com> (raw)
In-Reply-To: <20141023152322.GL9188@zion.uk.xensource.com>

El 23/10/14 a les 17.23, Wei Liu ha escrit:
> On Thu, Oct 23, 2014 at 04:30:24PM +0200, Roger Pau Monné wrote:
>> El 22/10/14 a les 18.29, Wei Liu ha escrit:
>>> Hi all
>>>
>>> This is my initial design to improve Xen balloon driver.
>>>
>>> PDF version with graphs can be found at
>>>
>>> http://xenbits.xen.org/people/liuw/xen-balloon-driver-improvement.pdf
>>>
>>> % Xen Balloon Driver Improvement
>>> % Wei Liu <<wei.liu2@citrix.com>>
>>>
>>> -------------------------------------------
>>> Version     Date         Changes
>>> -------     ----         ------------------
>>>   1         22/10/2014   Initial version.
>>> -------------------------------------------
>>>
>>> ## Motives
>>>
>>> 1. Balloon pages fragments guest physical address space.
>>> 1. Balloon compaction infrastructure can migrate ballooned pages from
>>>    start of zone to end of zone, hence creating contiguous guest physical
>>>    address space.
>>> 1. Having contiguous guest physical address enables some options to
>>>    improve performance.
>>>
>>> ## Goal of improvement
>>>
>>> Balloon driver makes use of as many huge pages as possible,
>>> defragmenting both guest address space and Xen pages. This should be
>>> achieved without any particular hypervisor side feature.
>>>
>>> ## Design and implementation
>>>
>>> When balloon driver is asked to increase / decrease reservation, it
>>> will always start with huge page. However, due to resource
>>> availability in both hypervisor and guest, it's not always possible to
>>> get hold of a huge page. In that case the driver will fall back to use
>>> normal size page. Balloon driver later will try to coalesce small size
>>> pages into huge page. As time goes by, both Xen and guest should use
>>> more and more huge pages.
>>
>> All this looks quite complicated IMHO, it's adding a lot of logic to the
>> balloon driver. Can't you just ask the memory subsystem to allocate a
>> page (or pages) from a specific physical range, and force it to page
>> out/move what's there at allocation time?
>>
>> For example I know FreeBSD has contigmalloc(9)[1] which I think could be
>> used to achieve this. You could start asking for pages starting at
>> maxpfn and go down from there, keeping fragmentation at a minimum.
>>
>> [1]
>> https://www.freebsd.org/cgi/man.cgi?query=contigmalloc&apropos=0&sektion=0&manpath=FreeBSD+10.1-RELEASE&arch=default&format=html
>>
> 
> Good point. Just that Linux doesn't have a counterpart, not that I know
> of. Memblock infrastructure looks similar but it's supposed to be used
> when initialising kernel.
> 
> Even if Linux has similar API, it's still less desirable because to
> satisfy a contiguous PA allocation, the system needs to be relative
> quiet (if NO_WAIT / ATOMIC is set), or the API needs to sleep for
> indefinite period (wait for memory subsystem to squeeze out pages).

There's no restriction on the time it might take for a guest to balloon
out. IMHO I would rather add a new interface to the Linux VM subsystem
that tries to accomplish this rather than adding a bunch of logic
specific to the balloon driver.

In general you should be able to reclaim memory quite fast (by either
moving it to another region or swapping it to disk). In case of finding
a page that's wired I would just leave it as is, since I guess this
would not be quite common, and maybe retry after a certain period.

Roger.

  reply	other threads:[~2014-10-23 15:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22 16:29 Xen balloon driver improvement (version 1) Wei Liu
2014-10-22 17:32 ` Andrew Cooper
2014-10-22 18:29   ` Wei Liu
2014-10-23 11:00     ` Ian Campbell
2014-10-23 11:05       ` Wei Liu
2014-10-23 11:42       ` Andrew Cooper
2014-10-23 11:44         ` David Vrabel
2014-10-23 10:09 ` David Vrabel
2014-10-23 10:52   ` Stefano Stabellini
2014-10-23 10:58     ` David Vrabel
2014-10-23 11:04   ` Wei Liu
2014-10-27 11:29   ` Wei Liu
2014-10-23 11:59 ` Ian Campbell
2014-10-23 12:17   ` Wei Liu
2014-10-23 12:27     ` Ian Campbell
2014-10-23 13:00       ` Wei Liu
2014-10-23 14:29         ` Ian Campbell
2014-10-23 14:30 ` Roger Pau Monné
2014-10-23 15:23   ` Wei Liu
2014-10-23 15:57     ` Roger Pau Monné [this message]
2014-10-23 16:04       ` Ian Campbell
2014-10-23 16:12         ` Wei Liu
2014-10-24 13:54 ` Dario Faggioli
2014-10-24 14:04   ` 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=54492560.50402@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@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.