]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
xmalloc: handle correctly page allocation when align > size
authorJulien Grall <julien.grall@linaro.org>
Mon, 10 Mar 2014 13:40:50 +0000 (14:40 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 10 Mar 2014 13:40:50 +0000 (14:40 +0100)
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".

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Keir Fraser <keir@xen.org>
xen/common/xmalloc_tlsf.c

index d3bdfa7d57a0d3b20b8f25db0076542ad2d93e66..a5769c9d3e4080fd2edbd8972008eea4d5917794 100644 (file)
@@ -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 )