ia64/xen-unstable

changeset 19142:9b9078a02f65

page_alloc: properly honor MAX_ORDER in init_heap_pages()

The previous check was flawed in that it checked
- for a single bit to be set instead of a range of bits to be clear
- a machine address against a mask supposed to be used on MFNs.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jan 30 11:14:23 2009 +0000 (2009-01-30)
parents e1135b40e783
children 86159a906bec
files xen/common/page_alloc.c
line diff
     1.1 --- a/xen/common/page_alloc.c	Fri Jan 30 11:13:55 2009 +0000
     1.2 +++ b/xen/common/page_alloc.c	Fri Jan 30 11:14:23 2009 +0000
     1.3 @@ -479,7 +479,6 @@ static void free_heap_pages(
     1.4   * latter is not on a MAX_ORDER boundary, then we reserve the page by
     1.5   * not freeing it to the buddy allocator.
     1.6   */
     1.7 -#define MAX_ORDER_ALIGNED (1UL << (MAX_ORDER))
     1.8  static void init_heap_pages(
     1.9      struct page_info *pg, unsigned long nr_pages)
    1.10  {
    1.11 @@ -496,15 +495,15 @@ static void init_heap_pages(
    1.12              init_node_heap(nid_curr);
    1.13  
    1.14          /*
    1.15 -         * free pages of the same node, or if they differ, but are on a
    1.16 -         * MAX_ORDER alignement boundary (which already get reserved)
    1.17 +         * Free pages of the same node, or if they differ, but are on a
    1.18 +         * MAX_ORDER alignment boundary (which already get reserved).
    1.19           */
    1.20 -         if ( (nid_curr == nid_prev) || (page_to_maddr(pg+i) &
    1.21 -                                         MAX_ORDER_ALIGNED) )
    1.22 -             free_heap_pages(pg+i, 0);
    1.23 -         else
    1.24 -             printk("Reserving non-aligned node boundary @ mfn %lu\n",
    1.25 -                    page_to_mfn(pg+i));
    1.26 +        if ( (nid_curr == nid_prev) ||
    1.27 +             !(page_to_mfn(pg+i) & ((1UL << MAX_ORDER) - 1)) )
    1.28 +            free_heap_pages(pg+i, 0);
    1.29 +        else
    1.30 +            printk("Reserving non-aligned node boundary @ mfn %#lx\n",
    1.31 +                   page_to_mfn(pg+i));
    1.32  
    1.33          nid_prev = nid_curr;
    1.34      }