Skip to contentSkip to conversation

dma/pool: eliminate alloc_pages warning in atomic_pool_expand

PATCH Applied Dave Kleikamp 3 participants 4 messages Dec 2, 2025 – Dec 8, 2025 DMA mapping helpers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma/pool: eliminate alloc_pages warning in atomic_pool_expand

atomic_pool_expand iterately tries the allocation while decrementing the page order. There is no need to issue a warning if an attempted allocation fails.

---
 kernel/dma/pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/pool.c +1 -1
index ee45dee33d49..26392badc36b 100644
@@ -93,7 +93,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
 			page = dma_alloc_from_contiguous(NULL, 1 << order,
 							 order, false);
 		if (!page)
-			page = alloc_pages(gfp, order);
+			page = alloc_pages(gfp | __GFP_NOWARN, order);
 	} while (!page && order-- > 0);
 	if (!page)
 		goto out;
Signature · 1 line
2.52.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Dave Kleikamp

atomic_pool_expand iterately tries the allocation while decrementing the

"iteratively"?

Quoted 13 lines

page order. There is no need to issue a warning if an attempted allocation fails.

---
  kernel/dma/pool.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/pool.c +0 -0
index ee45dee33d49..26392badc36b 100644

kernel/dma/pool.c static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, · line 96

Quoted 5 lines
kernel/dma/pool.c +1 -1
@@ -93,7 +93,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
  			page = dma_alloc_from_contiguous(NULL, 1 << order,
  							 order, false);
  		if (!page)
-			page = alloc_pages(gfp, order);
+			page = alloc_pages(gfp | __GFP_NOWARN, order);

Might be nice to keep some kind of warning if we entirely fail all the way down to order 0, although I guess if it matters it would show up via the warning on dma_alloc_from_pool() failure soon enough anyway...

Either way it certainly makes sense in general;

Quoted 3 lines
kernel/dma/pool.c +0 -0
  	} while (!page && order-- > 0);
  	if (!page)
  		goto out;
#2 lore raw
Quoted 4 lines · Robin Murphy
Quoted 1 line · Dave Kleikamp

atomic_pool_expand iterately tries the allocation while decrementing the

"iteratively"?

Oops.

Quoted 23 lines
Quoted 14 lines

page order. There is no need to issue a warning if an attempted allocation fails.

---
  kernel/dma/pool.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/pool.c +0 -0
index ee45dee33d49..26392badc36b 100644

kernel/dma/pool.c static int atomic_pool_expand(struct gen_pool *pool, · line 97

Quoted 6 lines
kernel/dma/pool.c +1 -1
@@ -93,7 +93,7 @@ static int atomic_pool_expand(struct gen_pool *pool, 
 size_t pool_size,
               page = dma_alloc_from_contiguous(NULL, 1 << order,
                                order, false);
           if (!page)
-            page = alloc_pages(gfp, order);
+            page = alloc_pages(gfp | __GFP_NOWARN, order);

Might be nice to keep some kind of warning if we entirely fail all the way down to order 0, although I guess if it matters it would show up via the warning on dma_alloc_from_pool() failure soon enough anyway...

Quoted 3 lines

Either way it certainly makes sense in general;

Thanks

Quoted 5 lines
Quoted 4 lines
kernel/dma/pool.c +0 -0
       } while (!page && order-- > 0);
       if (!page)

          goto out;

maintainer Applied
#3 lore raw
In reply to Dave Kleikamp
Quoted 5 lines · Dave Kleikamp

atomic_pool_expand iterately tries the allocation while decrementing the page order. There is no need to issue a warning if an attempted allocation fails.

Fixes d7e673ec2c8e ("dma-pool: Only allocate from CMA when in same

memory zone")

Applied to dma-mapping-fixes branch with typo in commit message fixed.

Quoted 9 lines
---
  kernel/dma/pool.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/pool.c +0 -0
index ee45dee33d49..26392badc36b 100644

kernel/dma/pool.c static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, · line 99

Quoted 8 lines
kernel/dma/pool.c +1 -1
@@ -93,7 +93,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
  			page = dma_alloc_from_contiguous(NULL, 1 << order,
  							 order, false);
  		if (!page)
-			page = alloc_pages(gfp, order);
+			page = alloc_pages(gfp | __GFP_NOWARN, order);
  	} while (!page && order-- > 0);
  	if (!page)
  		goto out;

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland