mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dma/pool: eliminate CMA alloc warning in atomic_pool_expand
@ 2026-10-30 10:00 ` Maximilian Heyne
  2026-11-03 10:56   ` Marek Szyprowski
  0 siblings, 1 reply; 2+ messages in thread
From: Maximilian Heyne @ 2026-10-30 10:00 UTC (permalink / raw)
  To: stable
  Cc: Maximilian Heyne, Marek Szyprowski, Robin Murphy,
	Nicolas Saenz Julienne, iommu, linux-kernel

atomic_pool_expand() allocates with decreasing page order first from the
CMA and if that fails via alloc_pages(). If the cma allocation fails a
warning, such as the following, is printed:

  cma: __cma_alloc_frozen: reserved: alloc failed, req-size: 4096 pages, ret: -16
  cma: number of available pages:
  cma: range 0: 1024@0
  cma:
  => 1024 free of 1024 total pages
  DMA: preallocated 262144 KiB GFP_KERNEL pool for atomic allocations

In this case the allocation succeeded via alloc_pages and therefore,
printing the warning is not necessary. Therefore, similar to commit
463d439becb8 ("dma/pool: eliminate alloc_pages warning in
atomic_pool_expand") silence the warning also for the CMA attempt.

Fixes: d7e673ec2c8e ("dma-pool: Only allocate from CMA when in same memory zone")
Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
---
 kernel/dma/pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c
index 00f422a1e8966..aa44fd74db538 100644
--- a/kernel/dma/pool.c
+++ b/kernel/dma/pool.c
@@ -99,7 +99,7 @@ static int atomic_pool_expand(struct dma_gen_pool *dma_pool, size_t pool_size,
 		pool_size = 1 << (PAGE_SHIFT + order);
 		if (cma_in_zone(gfp))
 			page = dma_alloc_from_contiguous(NULL, 1 << order,
-							 order, false);
+							 order, true);
 		if (!page)
 			page = alloc_pages(gfp | __GFP_NOWARN, order);
 	} while (!page && order-- > 0);
-- 
2.50.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dma/pool: eliminate CMA alloc warning in atomic_pool_expand
  2026-10-30 10:00 ` [PATCH] dma/pool: eliminate CMA alloc warning in atomic_pool_expand Maximilian Heyne
@ 2026-11-03 10:56   ` Marek Szyprowski
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Szyprowski @ 2026-11-03 10:56 UTC (permalink / raw)
  To: Maximilian Heyne, stable
  Cc: Robin Murphy, Nicolas Saenz Julienne, iommu, linux-kernel

On 30.10.2026 11:00, Maximilian Heyne wrote:
> atomic_pool_expand() allocates with decreasing page order first from the
> CMA and if that fails via alloc_pages(). If the cma allocation fails a
> warning, such as the following, is printed:
>
>   cma: __cma_alloc_frozen: reserved: alloc failed, req-size: 4096 pages, ret: -16
>   cma: number of available pages:
>   cma: range 0: 1024@0
>   cma:
>   => 1024 free of 1024 total pages
>   DMA: preallocated 262144 KiB GFP_KERNEL pool for atomic allocations
>
> In this case the allocation succeeded via alloc_pages and therefore,
> printing the warning is not necessary. Therefore, similar to commit
> 463d439becb8 ("dma/pool: eliminate alloc_pages warning in
> atomic_pool_expand") silence the warning also for the CMA attempt.
>
> Fixes: d7e673ec2c8e ("dma-pool: Only allocate from CMA when in same memory zone")
> Signed-off-by: Maximilian Heyne <mheyne@amazon.de>

Applied to dma-mapping-for-next. Thanks!

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-03 10:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20261030100043eucas1p195785d2a92ca9ff72ce7dab2fc397f20@eucas1p1.samsung.com>
2026-10-30 10:00 ` [PATCH] dma/pool: eliminate CMA alloc warning in atomic_pool_expand Maximilian Heyne
2026-11-03 10:56   ` Marek Szyprowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®