diff mbox series

[RFC/RFT,2/5] dma-remap: Run alloc_pages() on failure

Message ID 20190326224959.9656-3-nicoleotsuka@gmail.com (mailing list archive)
State RFC
Headers show
Series Save single pages from CMA area | expand

Commit Message

Nicolin Chen March 26, 2019, 10:49 p.m. UTC
The CMA allocation will skip allocations of single pages to save CMA
resource. This requires its callers to rebound those page allocations
from normal area.

So this patch moves the alloc_pages() call to the fallback routines.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
 kernel/dma/remap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolin Chen March 26, 2019, 10:53 p.m. UTC | #1
On Tue, Mar 26, 2019 at 03:49:56PM -0700, Nicolin Chen wrote:
> @@ -116,7 +116,7 @@ int __init dma_atomic_pool_init(gfp_t gfp, pgprot_t prot)
>  	if (dev_get_cma_area(NULL))
>  		page = dma_alloc_from_contiguous(NULL, nr_pages,
>  						 pool_size_order, false);
> -	else
> +	if (!page)
>  		page = alloc_pages(gfp, pool_size_order);

Just realized a missing change in this patch, will send v2.
Please ignore this version.
diff mbox series

Patch

diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c
index 2b750f13bc8f..daab2f3186a2 100644
--- a/kernel/dma/remap.c
+++ b/kernel/dma/remap.c
@@ -116,7 +116,7 @@  int __init dma_atomic_pool_init(gfp_t gfp, pgprot_t prot)
 	if (dev_get_cma_area(NULL))
 		page = dma_alloc_from_contiguous(NULL, nr_pages,
 						 pool_size_order, false);
-	else
+	if (!page)
 		page = alloc_pages(gfp, pool_size_order);
 	if (!page)
 		goto out;