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-devel

[Xen-devel] [PATCH] tmem: fix to 20945 "When tmem is enabled, reserve a

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] tmem: fix to 20945 "When tmem is enabled, reserve a fraction of memory"
From: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Date: Tue, 16 Feb 2010 10:30:22 -0800 (PST)
Cc: Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Tue, 16 Feb 2010 10:34:29 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
(Sorry, I was testing with this tweak to my previously posted
patch but had neglected to post it before the patch was taken.)

With tmem enabled, when available memory is scarce, don't allow
order==0 pages to be taken from the "midsize alloc zone" but
DO attempt to relinquish a page from tmem.  Else many
things fail when tmem has absorbed nearly all system memory.

Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>

diff -r 364001067e26 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Tue Feb 16 11:55:21 2010 +0000
+++ b/xen/common/page_alloc.c   Tue Feb 16 10:19:39 2010 -0700
@@ -311,9 +311,13 @@ static struct page_info *alloc_heap_page
      * TMEM: When available memory is scarce, allow only mid-size allocations
      * to avoid worst of fragmentation issues.
      */
-    if ( opt_tmem && ((order == 0) || (order >= 9)) &&
-         (total_avail_pages <= midsize_alloc_zone_pages) )
-        goto fail;
+    if ( opt_tmem && (total_avail_pages <= midsize_alloc_zone_pages) )
+    {
+        if ( order == 0)
+            goto try_tmem;
+        if ( order >= 9)
+            goto fail;
+    }
 
     /*
      * Start with requested node, but exhaust all node memory in requested 
@@ -341,6 +345,7 @@ static struct page_info *alloc_heap_page
     }
 
     /* Try to free memory from tmem */
+try_tmem:
     if ( (pg = tmem_relinquish_pages(order,memflags)) != NULL )
     {
         /* reassigning an already allocated anonymous heap page */

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