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

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



(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


 


Rackspace

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