WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add new boot parameter 'lowmem_emergency_pool' which creates
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 01 Apr 2006 10:20:07 +0000
Delivery-date: Sat, 01 Apr 2006 10:22:04 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add new boot parameter 'lowmem_emergency_pool' which creates, Xen patchbot -unstable <=