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

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

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Don't assume node0 is the first memory node
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Tue, 29 May 2007 12:16:40 -0600
Cc: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 29 May 2007 11:15:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: OSLO R&D
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
   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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Don't assume node0 is the first memory node, Alex Williamson <=