All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/malloc: handle correctly page allocation when align > size
@ 2014-03-07  6:46 Julien Grall
  2014-03-07 10:06 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2014-03-07  6:46 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>
---
 xen/common/xmalloc_tlsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/xmalloc_tlsf.c b/xen/common/xmalloc_tlsf.c
index d3bdfa7..c957119 100644
--- a/xen/common/xmalloc_tlsf.c
+++ b/xen/common/xmalloc_tlsf.c
@@ -531,7 +531,7 @@ static void *xmalloc_whole_pages(unsigned long size, unsigned long align)
     void *res, *p;
 
     if ( align > size )
-        get_order_from_bytes(align);
+        order = get_order_from_bytes(align);
 
     res = alloc_xenheap_pages(order, 0);
     if ( res == NULL )
-- 
1.8.5.3

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

* Re: [PATCH] xen/malloc: handle correctly page allocation when align > size
  2014-03-07  6:46 [PATCH] xen/malloc: handle correctly page allocation when align > size Julien Grall
@ 2014-03-07 10:06 ` Jan Beulich
  2014-03-09 15:25   ` Julien Grall
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2014-03-07 10:06 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel, keir

>>> On 07.03.14 at 07:46, Julien Grall <julien.grall@linaro.org> 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".

Oh, yes, of course it was. Without that the call is pointless.

> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Albeit in fact the better change might be to simply use
max(size, align) in the initializer of order - no idea why I didn't do
it that way.

Out of curiosity: I never expected this code path to be actually
taken - what is it that you need this to work correctly?

Jan

> --- a/xen/common/xmalloc_tlsf.c
> +++ b/xen/common/xmalloc_tlsf.c
> @@ -531,7 +531,7 @@ static void *xmalloc_whole_pages(unsigned long size, unsigned long align)
>      void *res, *p;
>  
>      if ( align > size )
> -        get_order_from_bytes(align);
> +        order = get_order_from_bytes(align);
>  
>      res = alloc_xenheap_pages(order, 0);
>      if ( res == NULL )

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

* Re: [PATCH] xen/malloc: handle correctly page allocation when align > size
  2014-03-07 10:06 ` Jan Beulich
@ 2014-03-09 15:25   ` Julien Grall
  0 siblings, 0 replies; 3+ messages in thread
From: Julien Grall @ 2014-03-09 15:25 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, keir



On 07/03/14 10:06, Jan Beulich wrote:
>>>> On 07.03.14 at 07:46, Julien Grall <julien.grall@linaro.org> 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".
>
> Oh, yes, of course it was. Without that the call is pointless.
>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>
> Albeit in fact the better change might be to simply use
> max(size, align) in the initializer of order - no idea why I didn't do
> it that way.

I can send a new version of this page to use max.

> Out of curiosity: I never expected this code path to be actually
> taken - what is it that you need this to work correctly?

I was looking to the code to decide if the best solution is to use 
xmalloc or alloc_xenheap_pages directly.

-- 
Julien Grall

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

end of thread, other threads:[~2014-03-09 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07  6:46 [PATCH] xen/malloc: handle correctly page allocation when align > size Julien Grall
2014-03-07 10:06 ` Jan Beulich
2014-03-09 15:25   ` Julien Grall

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.