All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xen/malloc: handle correctly page allocation when align > size
@ 2014-03-10 12:41 Julien Grall
  2014-03-10 13:28 ` Keir Fraser
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Grall @ 2014-03-10 12:41 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, keir, jbeulich

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>

---
    Changes in v2:
        - Use max
---
 xen/common/xmalloc_tlsf.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/common/xmalloc_tlsf.c b/xen/common/xmalloc_tlsf.c
index d3bdfa7..a5769c9 100644
--- a/xen/common/xmalloc_tlsf.c
+++ b/xen/common/xmalloc_tlsf.c
@@ -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 )
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] xen/malloc: handle correctly page allocation when align > size
  2014-03-10 12:41 [PATCH v2] xen/malloc: handle correctly page allocation when align > size Julien Grall
@ 2014-03-10 13:28 ` Keir Fraser
  0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2014-03-10 13:28 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel, jbeulich

Julien Grall wrote:
> 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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-10 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10 12:41 [PATCH v2] xen/malloc: handle correctly page allocation when align > size Julien Grall
2014-03-10 13:28 ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.