aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/setup.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2011-08-19 10:57:16 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-09-01 09:41:40 -0400
commitd312ae878b6aed3912e1acaaf5d0b2a9d08a4f11 (patch)
treec175aa92b7f7771698052d1b36f52becf21d3c2a /arch/x86/xen/setup.c
parent60c5f08e154fd235056645e050f2cd5671b19125 (diff)
xen: use maximum reservation to limit amount of usable RAM
Use the domain's maximum reservation to limit the amount of extra RAM for the memory balloon. This reduces the size of the pages tables and the amount of reserved low memory (which defaults to about 1/32 of the total RAM). On a system with 8 GiB of RAM with the domain limited to 1 GiB the kernel reports: Before: Memory: 627792k/4472000k available After: Memory: 549740k/11132224k available A increase of about 76 MiB (~1.5% of the unused 7 GiB). The reserved low memory is also reduced from 253 MiB to 32 MiB. The total additional usable RAM is 329 MiB. For dom0, this requires at patch to Xen ('x86: use 'dom0_mem' to limit the number of pages for dom0') (c/s 23790) CC: stable@kernel.org 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/setup.c')
-rw-r--r--arch/x86/xen/setup.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 02ffd9e48c9f..ff3dfa176814 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -183,6 +183,19 @@ static unsigned long __init xen_set_identity(const struct e820entry *list,
183 PFN_UP(start_pci), PFN_DOWN(last)); 183 PFN_UP(start_pci), PFN_DOWN(last));
184 return identity; 184 return identity;
185} 185}
186
187static unsigned long __init xen_get_max_pages(void)
188{
189 unsigned long max_pages = MAX_DOMAIN_PAGES;
190 domid_t domid = DOMID_SELF;
191 int ret;
192
193 ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
194 if (ret > 0)
195 max_pages = ret;
196 return min(max_pages, MAX_DOMAIN_PAGES);
197}
198
186/** 199/**
187 * machine_specific_memory_setup - Hook for machine specific memory setup. 200 * machine_specific_memory_setup - Hook for machine specific memory setup.
188 **/ 201 **/
@@ -291,6 +304,12 @@ char * __init xen_memory_setup(void)
291 304
292 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 305 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
293 306
307 extra_limit = xen_get_max_pages();
308 if (extra_limit >= max_pfn)
309 extra_pages = extra_limit - max_pfn;
310 else
311 extra_pages = 0;
312
294 extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); 313 extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820);
295 314
296 /* 315 /*