Skip to contentSkip to conversation

xen/malloc: handle correctly page allocation when align > size

PATCH In review Julien Grall 2 participants 2 messages Mar 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/malloc: handle correctly page allocation when align > size

When align is superior to size, we need to retrieve the order from align during multiple page allocation. I guess it was the goal of the commit fb034f42 "xmalloc: make close-to-PAGE_SIZE allocations more efficient".

---
Changes in v2:
- Use max

---
 xen/common/xmalloc_tlsf.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
xen/common/xmalloc_tlsf.c +2 -3
index d3bdfa7..a5769c9 100644
@@ -527,11 +527,10 @@ static void xmalloc_pool_put(void *p)
 
 static void *xmalloc_whole_pages(unsigned long size, unsigned long align)
 {
-    unsigned int i, order = get_order_from_bytes(size);
+    unsigned int i, order;
     void *res, *p;
 
-    if ( align > size )
-        get_order_from_bytes(align);
+    order = get_order_from_bytes(max(align, size));
 
     res = alloc_xenheap_pages(order, 0);
     if ( res == NULL )
Signature · 1 line
1.7.10.4