diff options
author | David Vrabel <david.vrabel@citrix.com> | 2011-09-28 12:46:32 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-09-29 11:12:09 -0400 |
commit | aa24411b6717fd1e6ecef281bec497f6f30bbd66 (patch) | |
tree | 1cab7520c7732067732fcdbdfb2c7c50811bd18a /arch/x86/xen | |
parent | d93dc5c4478c1fd5de85a3e8aece9aad7bbae044 (diff) |
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 'arch/x86/xen')
-rw-r--r-- | arch/x86/xen/setup.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 46d6d21dbdb..c983717c018 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -39,6 +39,9 @@ extern void xen_syscall32_target(void); | |||
39 | /* Amount of extra memory space we add to the e820 ranges */ | 39 | /* Amount of extra memory space we add to the e820 ranges */ |
40 | phys_addr_t xen_extra_mem_start, xen_extra_mem_size; | 40 | phys_addr_t xen_extra_mem_start, xen_extra_mem_size; |
41 | 41 | ||
42 | /* Number of pages released from the initial allocation. */ | ||
43 | unsigned long xen_released_pages; | ||
44 | |||
42 | /* | 45 | /* |
43 | * The maximum amount of extra memory compared to the base size. The | 46 | * The maximum amount of extra memory compared to the base size. The |
44 | * main scaling factor is the size of struct page. At extreme ratios | 47 | * main scaling factor is the size of struct page. At extreme ratios |
@@ -313,7 +316,9 @@ char * __init xen_memory_setup(void) | |||
313 | extra_pages = 0; | 316 | extra_pages = 0; |
314 | } | 317 | } |
315 | 318 | ||
316 | extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); | 319 | xen_released_pages = xen_return_unused_memory(xen_start_info->nr_pages, |
320 | &e820); | ||
321 | extra_pages += xen_released_pages; | ||
317 | 322 | ||
318 | /* | 323 | /* |
319 | * Clamp the amount of extra memory to a EXTRA_MEM_RATIO | 324 | * Clamp the amount of extra memory to a EXTRA_MEM_RATIO |