Fixes to sub 4GB allocator

Signed-off-by: ian@xensource.com
This commit is contained in:
iap10@freefall.cl.cam.ac.uk committed 2005-09-08 17:35:44 +00:00
1 parent d86b993b36
commit 8ecda20869
2 files changed
+14 -2

No files matched your search

+2 -1
View File
@@ -154,7 +154,8 @@ long do_memory_op(int cmd, void *arg)
reservation.nr_extents -= start_extent;
if ( (reservation.address_bits != 0) &&
(reservation.address_bits < (get_order(max_page) + PAGE_SHIFT)) )
(reservation.address_bits <
(get_order_from_pages(max_page) + PAGE_SHIFT)) )
{
if ( reservation.address_bits < 31 )
return -ENOMEM;
+12 -1
View File
@@ -280,7 +280,7 @@ extern void paging_init(void);
#ifndef __ASSEMBLY__
static __inline__ int get_order(unsigned long size)
static inline int get_order_from_bytes(physaddr_t size)
{
int order;
size = (size-1) >> PAGE_SHIFT;
@@ -289,6 +289,17 @@ static __inline__ int get_order(unsigned long size)
return order;
}
static inline int get_order_from_pages(unsigned long nr_pages)
{
int order;
nr_pages--;
for ( order = 0; nr_pages; order++ )
nr_pages >>= 1;
return order;
}
#define get_order(s) get_order_from_bytes(s)
/* Allocator functions for Xen pagetables. */
struct pfn_info *alloc_xen_pagetable(void);
void free_xen_pagetable(struct pfn_info *pg);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.