[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Add new boot parameter 'lowmem_emergency_pool' which creates



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e1267ac3cc364f377a05b7ea938a2493ceb1f968
# Parent  d76a7a40f3a997b7faa1e2e85acbde213aa68a8b
Add new boot parameter 'lowmem_emergency_pool' which creates
an emergency pool of pages below 4GB (i.e., in Xen's DMA pool)
which will ever be used to satisfy normal allocation requests.

This is particularly useful in an i386 PAE environment to ensure
that pages will always be available for allocation as
page-table base directories.

Usage, for example (to reserve 16MB):
 lowmem_emergency_pool=16M

In a PAE environment, each reserved megabyte guarantees you should
be able to create up to 256 processes (counted across all guests).
16MB means you're good for 4096 processes.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r d76a7a40f3a9 -r e1267ac3cc36 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Fri Mar 31 16:44:26 2006
+++ b/xen/common/page_alloc.c   Sat Apr  1 09:20:10 2006
@@ -42,6 +42,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.
+ */
+static unsigned long lowmem_emergency_pool_pages;
+static void parse_lowmem_emergency_pool(char *s)
+{
+    unsigned long long bytes;
+    bytes = parse_size_and_unit(s);
+    lowmem_emergency_pool_pages = bytes >> PAGE_SHIFT;
+}
+custom_param("lowmem_emergency_pool", parse_lowmem_emergency_pool);
+
 #define round_pgdown(_p)  ((_p)&PAGE_MASK)
 #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
 
@@ -514,7 +528,15 @@
     ASSERT(!in_irq());
 
     if ( !(flags & ALLOC_DOM_DMA) )
+    {
         pg = alloc_heap_pages(MEMZONE_DOM, order);
+        /* Failure? Then check if we can fall back to the DMA pool. */
+        if ( unlikely(pg == NULL) &&
+             ((order > MAX_ORDER) ||
+              (avail[MEMZONE_DMADOM] <
+               (lowmem_emergency_pool_pages + (1UL << order)))) )
+            return NULL;
+    }
 
     if ( pg == NULL )
         if ( (pg = alloc_heap_pages(MEMZONE_DMADOM, order)) == NULL )
@@ -657,7 +679,17 @@
 
 unsigned long avail_domheap_pages(void)
 {
-    return avail[MEMZONE_DOM] + avail[MEMZONE_DMADOM];
+    unsigned long avail_nrm, avail_dma;
+
+    avail_nrm = avail[MEMZONE_DOM];
+
+    avail_dma = avail[MEMZONE_DMADOM];
+    if ( avail_dma > lowmem_emergency_pool_pages )
+        avail_dma -= lowmem_emergency_pool_pages;
+    else
+        avail_dma = 0;
+
+    return avail_nrm + avail_dma;
 }
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.