linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: cma: fix alignment requirements for contiguous regions
@ 2012-08-24  7:20 Marek Szyprowski
  2012-08-24 16:46 ` Michal Nazarewicz
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Szyprowski @ 2012-08-24  7:20 UTC (permalink / raw)
  To: linux-kernel, linux-mm, linaro-mm-sig
  Cc: Michal Nazarewicz, Marek Szyprowski, Kyungmin Park,
	Andrew Morton, Mel Gorman, Arnd Bergmann

Contiguous Memory Allocator requires each of its regions to be aligned
in such a way that it is possible to change migration type for all
pageblocks holding it and then isolate page of largest possible order from
the buddy allocator (which is MAX_ORDER-1). This patch relaxes alignment
requirements by one order, because MAX_ORDER alignment is not really
needed.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
CC: Michal Nazarewicz <mina86@mina86.com>
---
 drivers/base/dma-contiguous.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
index 78efb03..34d94c7 100644
--- a/drivers/base/dma-contiguous.c
+++ b/drivers/base/dma-contiguous.c
@@ -250,7 +250,7 @@ int __init dma_declare_contiguous(struct device *dev, unsigned long size,
 		return -EINVAL;
 
 	/* Sanitise input arguments */
-	alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
+	alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
 	base = ALIGN(base, alignment);
 	size = ALIGN(size, alignment);
 	limit &= ~(alignment - 1);
-- 
1.7.1.569.g6f426

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm: cma: fix alignment requirements for contiguous regions
  2012-08-24  7:20 [PATCH] mm: cma: fix alignment requirements for contiguous regions Marek Szyprowski
@ 2012-08-24 16:46 ` Michal Nazarewicz
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Nazarewicz @ 2012-08-24 16:46 UTC (permalink / raw)
  To: Marek Szyprowski, linux-kernel, linux-mm, linaro-mm-sig
  Cc: Kyungmin Park, Andrew Morton, Mel Gorman, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 1557 bytes --]

Marek Szyprowski <m.szyprowski@samsung.com> writes:
> Contiguous Memory Allocator requires each of its regions to be aligned
> in such a way that it is possible to change migration type for all
> pageblocks holding it and then isolate page of largest possible order from
> the buddy allocator (which is MAX_ORDER-1). This patch relaxes alignment
> requirements by one order, because MAX_ORDER alignment is not really
> needed.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> CC: Michal Nazarewicz <mina86@mina86.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> ---
>  drivers/base/dma-contiguous.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
> index 78efb03..34d94c7 100644
> --- a/drivers/base/dma-contiguous.c
> +++ b/drivers/base/dma-contiguous.c
> @@ -250,7 +250,7 @@ int __init dma_declare_contiguous(struct device *dev, unsigned long size,
>  		return -EINVAL;
>  
>  	/* Sanitise input arguments */
> -	alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
> +	alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
>  	base = ALIGN(base, alignment);
>  	size = ALIGN(size, alignment);
>  	limit &= ~(alignment - 1);


-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--

[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.2: Type: application/pgp-signature, Size: 835 bytes --]

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

end of thread, other threads:[~2012-08-24 16:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-24  7:20 [PATCH] mm: cma: fix alignment requirements for contiguous regions Marek Szyprowski
2012-08-24 16:46 ` Michal Nazarewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox