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

[Xen-devel] [PATCH] Don't assume node0 is the first memory node



   init_heap_pages() makes the assumption that node0 will be the first
memory node.  On bigger boxes this is not necessarily true.  Instead of
pinning _heap0 and avail0 to nid 0, let's use them for the first node
that we free heap pages to.  Keir, please apply.  Thanks,

        Alex

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---

diff -r 2b14a1f22eec xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Fri May 25 09:43:21 2007 -0600
+++ b/xen/common/page_alloc.c   Tue May 29 12:08:31 2007 -0600
@@ -524,14 +524,6 @@ void init_heap_pages(
 
     ASSERT(zone < NR_ZONES);
 
-    if ( unlikely(avail[0] == NULL) )
-    {
-        /* Start-of-day memory node 0 initialisation. */
-        init_heap_block(&_heap0);
-        _heap[0] = &_heap0;
-        avail[0] = avail0;
-    }
-
     if ( likely(page_to_mfn(pg) != 0) )
         nid_prev = phys_to_nid(page_to_maddr(pg-1));
     else
@@ -543,10 +535,24 @@ void init_heap_pages(
 
         if ( !avail[nid_curr] )
         {
-            avail[nid_curr] = xmalloc_array(unsigned long, NR_ZONES);
-            memset(avail[nid_curr], 0, NR_ZONES * sizeof(long));
-            _heap[nid_curr] = xmalloc(heap_by_zone_and_order_t);
-            init_heap_block(_heap[nid_curr]);
+            static int first_node = 1;
+
+            if ( unlikely(first_node) )
+            {
+                /* Start-of-day first memory node initialisation. */
+                init_heap_block(&_heap0);
+                _heap[nid_curr] = &_heap0;
+                avail[nid_curr] = avail0;
+
+                first_node = 0;
+            }
+            else
+            {
+                avail[nid_curr] = xmalloc_array(unsigned long, NR_ZONES);
+                memset(avail[nid_curr], 0, NR_ZONES * sizeof(long));
+                _heap[nid_curr] = xmalloc(heap_by_zone_and_order_t);
+                init_heap_block(_heap[nid_curr]);
+            }
         }
 
         /*



_______________________________________________
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®.