Commit d9765e41 authored by Nicolas Saenz Julienne's avatar Nicolas Saenz Julienne Committed by Christoph Hellwig

dma-pool: do not allocate pool memory from CMA

There is no guarantee to CMA's placement, so allocating a zone specific
atomic pool from CMA might return memory from a completely different
memory zone. So stop using it.

Fixes: c84dc6e6 ("dma-pool: add additional coherent pools to map to gfp mask")
Reported-by: default avatarJeremy Linton <jeremy.linton@arm.com>
Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: default avatarJeremy Linton <jeremy.linton@arm.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 81e9d894
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/dma-direct.h> #include <linux/dma-direct.h>
#include <linux/dma-noncoherent.h> #include <linux/dma-noncoherent.h>
#include <linux/dma-contiguous.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/genalloc.h> #include <linux/genalloc.h>
#include <linux/set_memory.h> #include <linux/set_memory.h>
...@@ -69,12 +68,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, ...@@ -69,12 +68,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
do { do {
pool_size = 1 << (PAGE_SHIFT + order); pool_size = 1 << (PAGE_SHIFT + order);
page = alloc_pages(gfp, order);
if (dev_get_cma_area(NULL))
page = dma_alloc_from_contiguous(NULL, 1 << order,
order, false);
else
page = alloc_pages(gfp, order);
} while (!page && order-- > 0); } while (!page && order-- > 0);
if (!page) if (!page)
goto out; goto out;
...@@ -118,8 +112,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, ...@@ -118,8 +112,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
dma_common_free_remap(addr, pool_size); dma_common_free_remap(addr, pool_size);
#endif #endif
free_page: __maybe_unused free_page: __maybe_unused
if (!dma_release_from_contiguous(NULL, page, 1 << order)) __free_pages(page, order);
__free_pages(page, order);
out: out:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment