Index: xen-3.3.1-testing/xen/arch/x86/x86_32/mm.c =================================================================== --- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/mm.c +++ xen-3.3.1-testing/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) { unsigned long v; @@ -130,6 +132,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 *dom0_l2) Index: xen-3.3.1-testing/xen/common/page_alloc.c =================================================================== --- xen-3.3.1-testing.orig/xen/common/page_alloc.c +++ xen-3.3.1-testing/xen/common/page_alloc.c @@ -53,6 +53,20 @@ static int opt_bootscrub __initdata = 1; boolean_param("bootscrub", opt_bootscrub); /* + * 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 -- used to override NUMA-node-first. * allocation strategy, which can otherwise exhaust low memory. */