All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: xen-devel@lists.xensource.com,
	David Vrabel <david.vrabel@citrix.com>,
	JBeulich@novell.com, Konrad Wilk <konrad.wilk@oracle.com>
Subject: RE: xen: memory initialization/balloon fixes (#3)
Date: Thu, 22 Sep 2011 16:46:14 -0700 (PDT)	[thread overview]
Message-ID: <005ea591-cfb5-4ca0-9c9c-df2bbae88172@default> (raw)
In-Reply-To: <4E7BBC00.1050602@goop.org>

> From: Jeremy Fitzhardinge [mailto:jeremy@goop.org]
> 
> On 09/22/2011 03:34 PM, Dan Magenheimer wrote:
> >> I'm aware of that... "some" has been a fixed size of a few megabytes
> >> in Xen for a long time.  I am seeing 30-60MB or more.
> > Never mind on this part.  After further debugging, I can see
> > that this difference is due to normal uses of memory by the
> > kernel for XEN PAGETABLES and RAMDISK etc.  It's unfortunate
> > that the difference is so large, but I guess that's in part due
> > to the desire to use the same kernel binary for native and
> > virtualized.  I don't remember it being nearly so high for
> > older PV kernels, but I guess it's progress! :-}
> 
> I don't think the Xen parts allocate/reserves lots of memory
> unnecessarily, so it shouldn't be too different from the 2.6.18-xen
> kernels.  They do reserve various chunks of memory, but for things like
> RAMDISK I think they get released again (and anyway, I don't think
> that's going to be anywhere near 30MB, let alone 60).  I'm not very
> confident in those /proc/meminfo numbers - they may count memory as
> "reserved" if its in a reserved region even if the pages themselves have
> been released to the kernel pool.

No, the first line of /proc/meminfo is precisely "totalram_pages".
 
> >>>> Part B of the problem (and the one most important to me) is that
> >>>> setting /sys/devices/system/xen_memory/xen_memory0/target_kb
> >>>> to X results in a MemTotal inside the domU (as observed by
> >>>> "head -1 /proc/meminfo") of X-D.  This can be particularly painful
> >>>> when X is aggressively small as X-D may result in OOMs.
> >>>> To use kernel function/variable names (and I observed this with
> >>>> some debugging code), when balloon_set_new_target(X) is called
> >>>> totalram_pages gets driven to X-D.
> >>> Again, this looks like the correct behavior to me.
> >> Hmmm... so if a user (or automated tool) uses the Xen-defined
> >> API (i.e. /sys/devices/system/xen_memory/xen_memory0/target_kb)
> >> to use the Xen balloon driver to attempt to reduce memory usage
> >> to 100MB, and the Xen balloon driver instead reduces it to
> >> some random number somewhere between 40MB and 90MB, which
> >> may or may not cause OOMs, you consider this correct behavior?
> > I still think this is a bug but apparently orthogonal to
> > your patchset.  So sorry to bother you.
> 
> If you ask for 100MB, it should never try to make the domain smaller
> than that; if it does, it suggests the number is being misparsed or
> something.

OK then balloon_stats.current_pages can never be larger than totalram_pages.
Which means that balloon_stats.current_pages must always grow
and shrink when totalram_pages does (which is true now only in
the balloon driver code).  Which means, I think:

balloon_stats.current_pages is just plain wrong!  It doesn't need to
exist!  If we replace every instance in balloon.c with totalram_pages,
I think everything just works.  Will run some tests tomorrow.

Dan

P.S. Not sure about Daniel's hotplug stuff though....

  reply	other threads:[~2011-09-22 23:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-15 12:29 xen: memory initialization/balloon fixes (#3) David Vrabel
2011-09-15 12:29 ` [PATCH 1/7] xen: use maximum reservation to limit amount of usable RAM David Vrabel
2011-09-21 15:09   ` Konrad Rzeszutek Wilk
2011-09-15 12:29 ` [PATCH 2/7] xen: avoid adding non-existant memory if the reservation is unlimited David Vrabel
2011-09-21 15:08   ` Unknown, Konrad Rzeszutek
2011-09-15 12:29 ` [PATCH 3/7] xen/balloon: account for pages released during memory setup David Vrabel
2011-09-21 15:05   ` Konrad Rzeszutek Wilk
2011-09-15 12:29 ` [PATCH 4/7] xen/balloon: simplify test for the end of usable RAM David Vrabel
2011-09-15 12:29 ` [PATCH 5/7] xen: allow balloon driver to use more than one memory region David Vrabel
2011-09-15 12:29 ` [PATCH 6/7] xen: allow extra memory to be in multiple regions David Vrabel
2011-09-15 12:29 ` [PATCH 7/7] xen: release all pages within 1-1 p2m mappings David Vrabel
2011-09-20 16:57 ` xen: memory initialization/balloon fixes (#3) Dan Magenheimer
2011-09-21 22:29   ` Dan Magenheimer
2011-09-22 12:32   ` David Vrabel
2011-09-22 17:06     ` Dan Magenheimer
2011-09-22 22:34       ` Dan Magenheimer
2011-09-22 22:51         ` Jeremy Fitzhardinge
2011-09-22 23:46           ` Dan Magenheimer [this message]
2011-09-23 10:45             ` David Vrabel
2011-09-23 13:28               ` Konrad Rzeszutek Wilk
2011-09-23 19:04               ` Dan Magenheimer
2011-09-21 17:11 ` Konrad Rzeszutek Wilk
2011-09-22 13:08   ` David Vrabel
2011-09-24  2:08 ` Konrad Rzeszutek Wilk
2011-09-26 14:20   ` Konrad Rzeszutek Wilk
2011-09-27 14:09   ` David Vrabel
2011-09-27 23:10     ` Konrad Rzeszutek Wilk
2011-09-28 10:45       ` David Vrabel
2011-09-28 13:25         ` Konrad Rzeszutek Wilk
2011-09-28 13:47         ` Konrad Rzeszutek Wilk

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=005ea591-cfb5-4ca0-9c9c-df2bbae88172@default \
    --to=dan.magenheimer@oracle.com \
    --cc=JBeulich@novell.com \
    --cc=david.vrabel@citrix.com \
    --cc=jeremy@goop.org \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.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 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.