All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xensource.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH 3/7] xen/balloon: account for pages released during memory setup
Date: Wed, 21 Sep 2011 11:05:22 -0400	[thread overview]
Message-ID: <20110921150522.GD541@phenom.oracle.com> (raw)
In-Reply-To: <1316089768-22461-4-git-send-email-david.vrabel@citrix.com>

On Thu, Sep 15, 2011 at 01:29:24PM +0100, David Vrabel wrote:
> From: David Vrabel <david.vrabel@citrix.com>
> 
> In xen_memory_setup() pages that occur in gaps in the memory map are
> released back to Xen.  This reduces the domain's current page count in
> the hypervisor.  The Xen balloon driver does not correctly decrease
> its initial current_pages count to reflect this.  If 'delta' pages are
> released and the target is adjusted the resulting reservation is
> always 'delta' less than the requested target.
> 
> This affects dom0 if the initial allocation of pages overlaps the PCI
> memory region but won't affect most domU guests that have been setup
> with pseudo-physical memory maps that don't have gaps.
> 
> Fix this by accouting for the released pages when starting the balloon
> driver.

Does this make the behaviour of the pvops guest be similar to the
old-style XenOLinux? If so, perhaps we should include that in the git
description for usability purposes (ie, when somebody searches the git
log for what has happened in v3.2 Linux).
> 
> If the domain's targets are managed by xapi, the domain may eventually
> run out of memory and die because xapi currently gets its target
> calculations wrong and whenever it is restarted it always reduces the
> target by 'delta'.

> 
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> ---
>  arch/x86/xen/setup.c  |    7 ++++++-
>  drivers/xen/balloon.c |    4 +++-
>  include/xen/page.h    |    2 ++
>  3 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
> index 46d6d21..c983717 100644
> --- a/arch/x86/xen/setup.c
> +++ b/arch/x86/xen/setup.c
> @@ -39,6 +39,9 @@ extern void xen_syscall32_target(void);
>  /* Amount of extra memory space we add to the e820 ranges */
>  phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
>  
> +/* Number of pages released from the initial allocation. */
> +unsigned long xen_released_pages;
> +
>  /* 
>   * The maximum amount of extra memory compared to the base size.  The
>   * main scaling factor is the size of struct page.  At extreme ratios
> @@ -313,7 +316,9 @@ char * __init xen_memory_setup(void)
>  			extra_pages = 0;
>  	}
>  
> -	extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820);
> +	xen_released_pages = xen_return_unused_memory(xen_start_info->nr_pages,
> +						      &e820);
> +	extra_pages += xen_released_pages;
>  
>  	/*
>  	 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
> index 5dfd8f8..4f59fb3 100644
> --- a/drivers/xen/balloon.c
> +++ b/drivers/xen/balloon.c
> @@ -565,7 +565,9 @@ static int __init balloon_init(void)
>  
>  	pr_info("xen/balloon: Initialising balloon driver.\n");
>  
> -	balloon_stats.current_pages = xen_pv_domain() ? min(xen_start_info->nr_pages, max_pfn) : max_pfn;
> +	balloon_stats.current_pages = xen_pv_domain()
> +		? min(xen_start_info->nr_pages - xen_released_pages, max_pfn)
> +		: max_pfn;
>  	balloon_stats.target_pages  = balloon_stats.current_pages;
>  	balloon_stats.balloon_low   = 0;
>  	balloon_stats.balloon_high  = 0;
> diff --git a/include/xen/page.h b/include/xen/page.h
> index 0be36b9..92b61f8 100644
> --- a/include/xen/page.h
> +++ b/include/xen/page.h
> @@ -5,4 +5,6 @@
>  
>  extern phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
>  
> +extern unsigned long xen_released_pages;
> +
>  #endif	/* _XEN_PAGE_H */
> -- 
> 1.7.2.5
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

  reply	other threads:[~2011-09-21 15:05 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 [this message]
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
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=20110921150522.GD541@phenom.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=david.vrabel@citrix.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.