Don't assume node0 is the first memory node
PATCH 1/1 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 <[email protected]>
---
xen/common/page_alloc.c +18 -12
@@ -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]); + } }/*