Re: [PATCH] mm: cma: fix alignment requirements for contiguous regions

From: Michal Nazarewicz
Date: Fri Aug 24 2012 - 12:46:41 EST


Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> 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@xxxxxxxxxxx>
> CC: Michal Nazarewicz <mina86@xxxxxxxxxx>

Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>

> ---
> 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@xxxxxxxxxx>--------------ooO--(_)--Ooo--

Attachment: pgp00000.pgp
Description: PGP signature