summaryrefslogtreecommitdiffstats
path: root/drivers/xen/balloon.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2011-09-28 17:46:32 +0100
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-09-29 11:12:09 -0400
commitaa24411b6717fd1e6ecef281bec497f6f30bbd66 (patch)
tree1cab7520c7732067732fcdbdfb2c7c50811bd18a /drivers/xen/balloon.c
parentd93dc5c4478c1fd5de85a3e8aece9aad7bbae044 (diff)
downloadlinux-aa24411b6717fd1e6ecef281bec497f6f30bbd66.tar.bz2
xen/balloon: account for pages released during memory setup
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. 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> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen/balloon.c')
-rw-r--r--drivers/xen/balloon.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 5dfd8f8ff07f..4f59fb373381 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;