xen/xen-lowmem-emergency-pool.diff

60 lines
2.1 KiB
Diff
Raw Normal View History

Index: xen-unstable/xen/arch/x86/x86_32/mm.c
===================================================================
--- xen-unstable.orig/xen/arch/x86/x86_32/mm.c
+++ xen-unstable/xen/arch/x86/x86_32/mm.c
@@ -63,6 +63,8 @@ l2_pgentry_t *virt_to_xen_l2e(unsigned l
return &idle_pg_table_l2[l2_linear_offset(v)];
}
+extern unsigned long lowmem_emergency_pool_pages;
+
void __init paging_init(void)
{
void *ioremap_pt;
@@ -131,6 +133,20 @@ void __init setup_idle_pagetable(void)
l2e_from_page(virt_to_page(idle_vcpu[0]->domain->
arch.mm_perdomain_pt) + i,
__PAGE_HYPERVISOR));
+
+ /*
+ * Size the lowmem_emergency_pool based on the total memory on the box
+ * This pool is needed only on 32 bit PAE configurations (4g to 16g).
+ */
+ if (lowmem_emergency_pool_pages)
+ return;
+
+ if (total_pages > (4 * 1024 * 1024))
+ lowmem_emergency_pool_pages = 12000;
+ else if (total_pages > (2 * 1024 * 1024))
+ lowmem_emergency_pool_pages = 8000;
+ else if (total_pages > (1 * 1024 * 1024) || max_page >= (1 * 1024 * 1024))
+ lowmem_emergency_pool_pages = 4000;
}
void __init zap_low_mappings(l2_pgentry_t *base)
Index: xen-unstable/xen/common/page_alloc.c
===================================================================
--- xen-unstable.orig/xen/common/page_alloc.c
+++ xen-unstable/xen/common/page_alloc.c
@@ -46,6 +46,20 @@ static char opt_badpage[100] = "";
string_param("badpage", opt_badpage);
/*
+ * Amount of memory to reserve in a low-memory (<4GB) pool for specific
+ * allocation requests. Ordinary requests will not fall back to the
+ * lowmem emergency pool.
+ */
+unsigned long lowmem_emergency_pool_pages;
+static void parse_lowmem_emergency_pool(char *s)
+{
+ unsigned long long bytes;
+ bytes = parse_size_and_unit(s, NULL);
+ lowmem_emergency_pool_pages = bytes >> PAGE_SHIFT;
+}
+custom_param("lowmem_emergency_pool", parse_lowmem_emergency_pool);
+
+/*
* Bit width of the DMA heap.
*/
static unsigned int dma_bitsize = CONFIG_DMA_BITSIZE;