ia64/xen-unstable

changeset 6705:1f4863861d18

Fixes to sub 4GB allocator
Signed-off-by: ian@xensource.com
author iap10@freefall.cl.cam.ac.uk
date Thu Sep 08 17:35:44 2005 +0000 (2005-09-08)
parents c2705e74efba
children 5db85ba1c4e0
files xen/common/memory.c xen/include/asm-x86/page.h
line diff
     1.1 --- a/xen/common/memory.c	Thu Sep 08 15:22:01 2005 +0000
     1.2 +++ b/xen/common/memory.c	Thu Sep 08 17:35:44 2005 +0000
     1.3 @@ -154,7 +154,8 @@ long do_memory_op(int cmd, void *arg)
     1.4          reservation.nr_extents -= start_extent;
     1.5  
     1.6          if ( (reservation.address_bits != 0) &&
     1.7 -             (reservation.address_bits < (get_order(max_page) + PAGE_SHIFT)) )
     1.8 +             (reservation.address_bits <
     1.9 +              (get_order_from_pages(max_page) + PAGE_SHIFT)) )
    1.10          {
    1.11              if ( reservation.address_bits < 31 )
    1.12                  return -ENOMEM;
     2.1 --- a/xen/include/asm-x86/page.h	Thu Sep 08 15:22:01 2005 +0000
     2.2 +++ b/xen/include/asm-x86/page.h	Thu Sep 08 17:35:44 2005 +0000
     2.3 @@ -280,7 +280,7 @@ extern void paging_init(void);
     2.4  
     2.5  #ifndef __ASSEMBLY__
     2.6  
     2.7 -static __inline__ int get_order(unsigned long size)
     2.8 +static inline int get_order_from_bytes(physaddr_t size)
     2.9  {
    2.10      int order;
    2.11      size = (size-1) >> PAGE_SHIFT;
    2.12 @@ -289,6 +289,17 @@ static __inline__ int get_order(unsigned
    2.13      return order;
    2.14  }
    2.15  
    2.16 +static inline int get_order_from_pages(unsigned long nr_pages)
    2.17 +{
    2.18 +    int order;
    2.19 +    nr_pages--;
    2.20 +    for ( order = 0; nr_pages; order++ )
    2.21 +        nr_pages >>= 1;
    2.22 +    return order;
    2.23 +}
    2.24 +
    2.25 +#define get_order(s) get_order_from_bytes(s)
    2.26 +
    2.27  /* Allocator functions for Xen pagetables. */
    2.28  struct pfn_info *alloc_xen_pagetable(void);
    2.29  void free_xen_pagetable(struct pfn_info *pg);