All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>, xen-devel@lists.xen.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: Xen balloon driver improvement (version 1)
Date: Thu, 23 Oct 2014 11:09:19 +0100	[thread overview]
Message-ID: <5448D3CF.8090005@citrix.com> (raw)
In-Reply-To: <20141022162930.GA8489@zion.uk.xensource.com>

On 22/10/14 17:29, Wei Liu wrote:
> 
> ### 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
> being enforced, it can still compact memory.

XENMEM_exchange doesn't really have the behaviour that is needed here.

Page migration splits the memory map into two parts, the populated area
at the bottom and the balloon area.  The populated area is fragmented by
ballooned pages, and the balloon area is fragmented by populated pages.

Consider a single ballooned page in the middle of an otherwise intact
superframe.  Page migration wants to populate this page and depopulate a
different page from the balloon area.

A hypercall that can do an atomic populate and depopulate will allow xen
to easily recreate the superframe (if the missing frame is free).
XENMEM_exchange will leave the superframe fragmented.

XENMEM_exchange would be an acceptable fallback when this new hypercall
is not availble.

> ### Maintain multiple queues for pages of different sizes and purposes
> 
> We maintain multiple queues for pages of different sizes inside Xen
> balloon driver, so that Xen balloon worker thread can coalesce smaller
> size pages into one larger size page. Queues for special purposed
> pages, such as balloon pages used to map foreign pages, are also
> maintained. These special purposed pages are not subject to migration
> and page coalescence.
> 
> For instance, balloon driver can maintain three queues:
> 
> 1. queue for 2 MB pages
> 1. queue for 4 KB pages (delegated to core balloon driver)
> 1. queue for pages used to mapped pages from other domain
> 
> More queues can be added when necessary, but for now one queue for
> normal pages and one queue for huge page should be enough.

Can you explain why is this specific to Xen and why other hypervisors
wouldn't want to make use of all this huge page infrastructure?

> ### Worker thread to coalesce small size pages
> 
> Worker thread wakes up periodically to check if there's 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 think you need a new worker thread for this,  the existing page
migration is already trying to keep the ballooned zone contiguous so
after migrating pages you need only try and move contiguous ballooned 4k
pages to the 2M list.

> ## Flowcharts
> 
> These flowcharts assume normal page size is 4K and huge page size is
> 2M.  They show how two queues are maintained.

Having to break 2M pages into 4k ones to meet a target suggests that the
toolstack should allocate a domain with 2M multiples and should set the
target in 2M multiples only.  The autoballoon driver will also need to
set the target in 2M multiples.

David

  parent reply	other threads:[~2014-10-23 10:09 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 [this message]
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é
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=5448D3CF.8090005@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.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.