]> Git Repo - linux.git/commitdiff
dma-pool: do not allocate pool memory from CMA
authorNicolas Saenz Julienne <[email protected]>
Wed, 8 Jul 2020 16:49:39 +0000 (18:49 +0200)
committerChristoph Hellwig <[email protected]>
Tue, 14 Jul 2020 13:46:32 +0000 (15:46 +0200)
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: c84dc6e68a1d ("dma-pool: add additional coherent pools to map to gfp mask")
Reported-by: Jeremy Linton <[email protected]>
Signed-off-by: Nicolas Saenz Julienne <[email protected]>
Tested-by: Jeremy Linton <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
kernel/dma/pool.c

index d48d9acb585f711c4c5fc316f7e1ac2b8e7c9b7a..6bc74a2d51273e3d32c841844f8f0f8f2eac079d 100644 (file)
@@ -6,7 +6,6 @@
 #include <linux/debugfs.h>
 #include <linux/dma-direct.h>
 #include <linux/dma-noncoherent.h>
-#include <linux/dma-contiguous.h>
 #include <linux/init.h>
 #include <linux/genalloc.h>
 #include <linux/set_memory.h>
@@ -69,12 +68,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
 
        do {
                pool_size = 1 << (PAGE_SHIFT + order);
-
-               if (dev_get_cma_area(NULL))
-                       page = dma_alloc_from_contiguous(NULL, 1 << order,
-                                                        order, false);
-               else
-                       page = alloc_pages(gfp, order);
+               page = alloc_pages(gfp, order);
        } while (!page && order-- > 0);
        if (!page)
                goto out;
@@ -118,8 +112,7 @@ remove_mapping:
        dma_common_free_remap(addr, pool_size);
 #endif
 free_page: __maybe_unused
-       if (!dma_release_from_contiguous(NULL, page, 1 << order))
-               __free_pages(page, order);
+       __free_pages(page, order);
 out:
        return ret;
 }
This page took 0.052709 seconds and 4 git commands to generate.