[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xa1td2f91qw5.fsf@mina86.com>
Date: Mon, 19 May 2014 09:59:22 -1000
From: Michal Nazarewicz <mina86@...a86.com>
To: Joonsoo Kim <iamjoonsoo.kim@....com>, Gioh Kim <gioh.kim@....com>
Cc: Minchan Kim <minchan.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Rik van Riel <riel@...hat.com>,
Laura Abbott <lauraa@...eaurora.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Heesub Shin <heesub.shin@...sung.com>,
Mel Gorman <mgorman@...e.de>,
Johannes Weiner <hannes@...xchg.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
이건호 <gunho.lee@....com>, gurugio@...il.com
Subject: Re: [RFC][PATCH] CMA: drivers/base/Kconfig: restrict CMA size to non-zero value
On Sun, May 18 2014, Joonsoo Kim wrote:
> I think that this problem is originated from atomic_pool_init().
> If configured coherent_pool size is larger than default cma size,
> it can be failed even if this patch is applied.
>
> How about below patch?
> It uses fallback allocation if CMA is failed.
Yes, I thought about it, but __dma_alloc uses similar code:
else if (!IS_ENABLED(CONFIG_DMA_CMA))
addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller);
else
addr = __alloc_from_contiguous(dev, size, prot, &page, caller);
so it probably needs to be changed as well.
> -----------------8<---------------------
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index 6b00be1..2909ab9 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -379,7 +379,7 @@ static int __init atomic_pool_init(void)
> unsigned long *bitmap;
> struct page *page;
> struct page **pages;
> - void *ptr;
> + void *ptr = NULL;
> int bitmap_size = BITS_TO_LONGS(nr_pages) * sizeof(long);
>
> bitmap = kzalloc(bitmap_size, GFP_KERNEL);
> @@ -393,7 +393,7 @@ static int __init atomic_pool_init(void)
> if (IS_ENABLED(CONFIG_DMA_CMA))
> ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page,
> atomic_pool_init);
> - else
> + if (!ptr)
> ptr = __alloc_remap_buffer(NULL, pool->size, gfp, prot, &page,
> atomic_pool_init);
> if (ptr) {
>
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +--<mpn@...gle.com>--<xmpp:mina86@...ber.org>--ooO--(_)--Ooo--
Download attachment "signature.asc" of type "application/pgp-signature" (836 bytes)
Powered by blists - more mailing lists