From: Olaf Hering <olaf@aepfle.de>
To: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Keir Fraser <keir@xen.org>, Konrad Wilk <konrad.wilk@oracle.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Kurt Hackel <kurt.hackel@oracle.com>,
tim@xen.org, xen-devel@lists.xen.org,
George Shuklin <george.shuklin@gmail.com>,
Dario Faggioli <raistlin@linux.it>,
Andres Lagar-Cavilla <andreslc@gridcentric.ca>,
Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: domain creation vs querying free memory (xend and xl)
Date: Thu, 4 Oct 2012 20:26:13 +0200 [thread overview]
Message-ID: <20121004182613.GA9244@aepfle.de> (raw)
In-Reply-To: <8ba2021c-1095-4fd1-98a5-f6eec8a3498b@default>
On Mon, Oct 01, Dan Magenheimer wrote:
> > From: Ian Jackson [mailto:Ian.Jackson@eu.citrix.com]
> > Sent: Friday, September 28, 2012 11:12 AM
> > To: Dan Magenheimer
> > Cc: xen-devel@lists.xen.org; Kurt Hackel; Konrad Wilk
> > Subject: Re: [Xen-devel] domain creation vs querying free memory (xend and xl)
> >
> > Dan Magenheimer writes ("[Xen-devel] domain creation vs querying free memory (xend and xl)"):
> > > But the second domain launch fails, possibly after
> > > several minutes because, actually, there isn't enough
> > > physical RAM for both.
> >
> > This is a real problem. The solution is not easy, and may not make it
> > for 4.3. It would involve a rework of the memory handling code in
> > libxl.
>
> [broadening cc to "Xen memory technology people", please forward/add
> if I missed someone]
Dan,
I'm sure there has been already alot of thought and discussion about
this issue, So here are my thoughts:
In my opinion the code which is about to start a domain has to take all
currently created/starting/running/dying domains, and their individual
"allocation behaviour", into account before it can finally launch the
domain. All of this needs math, not locking.
A domain (domU or dom0) has a couple of constraints:
- current nr_pages vs. target_nr_pages vs. max_pages
- current PoD allocation vs. max_PoD
- current paged_pages vs. target_nr_pages vs. max_paged_pages
- some shared_pages
- some tmem
- maybe grant_pages
- ...
Depending on the state (starting and working towards a target number,
running, dying) the "current" numbers above will increase or shrink. So
the algorithm which turns the parameters above for each domain into a
total number of allocated (or soon to be allocated) host memory has to
work with "target numbers" instead of what is currently allocated.
Some examples that come to mind:
- a PoD domain will most likely use all of the pages configured with
memory=, so that number should be used
- the number shared pages is eventually not predictable. If so, this
number could be handled as "allocated to the guest". Maybe a knob to
say "running domains will have amount N shared" can exist? Dont know
much about how sharing looks in practice.
- ballooning may not reach the configured target, and the guest admin
can just balloon up to the limit without notifying the toolstack
- a new paging target will take some time until its reached, there is
always some jitter during page-in/page-out, mapping guest pages will
cause nomination failures.
- tmem does something, I dont know.
- no idea if grant pages are needed in the math
Since the central management of xend is gone each libxl process is
likely on its own, so two "xl create" can race when doing the math.
Maybe a libxl process dies and leaves a mess behind. So that could make
it difficult to get a good snapshot of the memory situation on the host.
Maybe each domain could get some metadata to record the individual
current/target/max numbers. Or if xenstore is good enough, something can
cleanup zombie numbers.
As IanJ said, the memory handling code in libxl needs such a feature to
do the math right. The proposed handling of
sharing/paging/ballooning/PoD/tmem/... in libxl is just a small part of
it.
Olaf
next prev parent reply other threads:[~2012-10-04 18:26 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 21:17 domain creation vs querying free memory (xend and xl) Dan Magenheimer
2012-09-27 11:26 ` Konrad Rzeszutek Wilk
2012-09-27 15:32 ` Dan Magenheimer
2012-09-27 15:24 ` George Shuklin
2012-09-28 16:08 ` Dario Faggioli
2012-10-02 18:17 ` Dan Magenheimer
2012-09-28 17:12 ` Ian Jackson
2012-10-01 20:03 ` Dan Magenheimer
2012-10-02 9:10 ` Tim Deegan
2012-10-02 9:47 ` Ian Campbell
2012-10-02 19:33 ` Dan Magenheimer
2012-10-02 20:16 ` Tim Deegan
2012-10-02 21:56 ` Dan Magenheimer
2012-10-04 10:06 ` Tim Deegan
2012-10-04 10:17 ` Ian Campbell
2012-10-04 13:20 ` Andres Lagar-Cavilla
2012-10-04 13:25 ` Ian Campbell
2012-10-04 16:54 ` Dan Magenheimer
2012-10-04 17:00 ` Andres Lagar-Cavilla
2012-10-05 9:44 ` Ian Campbell
2012-10-05 11:40 ` George Dunlap
2012-10-08 1:02 ` Dan Magenheimer
2012-10-16 11:49 ` George Dunlap
2012-10-16 17:51 ` Dan Magenheimer
2012-10-17 17:35 ` George Dunlap
2012-10-17 18:33 ` Andres Lagar-Cavilla
2012-10-17 19:46 ` Dan Magenheimer
2012-10-17 20:14 ` Andres Lagar-Cavilla
2012-10-17 22:07 ` Dan Magenheimer
2012-10-17 18:45 ` Dan Magenheimer
2012-10-17 17:35 ` George Dunlap
2012-10-04 13:33 ` Andres Lagar-Cavilla
2012-10-04 16:59 ` Dan Magenheimer
2012-10-04 17:08 ` Andres Lagar-Cavilla
2012-10-04 17:18 ` Dan Magenheimer
2012-10-04 17:30 ` Andres Lagar-Cavilla
2012-10-04 17:55 ` Dan Magenheimer
2012-10-05 14:25 ` Andres Lagar-Cavilla
2012-10-07 23:43 ` Dan Magenheimer
2012-10-04 16:36 ` Dan Magenheimer
2012-10-04 18:26 ` Olaf Hering [this message]
2012-10-04 19:38 ` Dan Magenheimer
2012-10-04 20:18 ` Olaf Hering
2012-10-04 20:35 ` Dan Magenheimer
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=20121004182613.GA9244@aepfle.de \
--to=olaf@aepfle.de \
--cc=George.Dunlap@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=andreslc@gridcentric.ca \
--cc=dan.magenheimer@oracle.com \
--cc=george.shuklin@gmail.com \
--cc=keir@xen.org \
--cc=konrad.wilk@oracle.com \
--cc=kurt.hackel@oracle.com \
--cc=raistlin@linux.it \
--cc=tim@xen.org \
--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 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).