iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma/pool: eliminate alloc_pages warning in atomic_pool_expand
@ 2025-12-02 15:28 ` Dave Kleikamp
  2025-12-02 15:47   ` Robin Murphy
  2025-12-08  8:41   ` Marek Szyprowski
  0 siblings, 2 replies; 4+ messages in thread
From: Dave Kleikamp @ 2025-12-02 15:28 UTC (permalink / raw)
  To: Marek Szyprowski, Robin Murphy; +Cc: iommu, linux-kernel

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.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
---
 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 ee45dee33d49..26392badc36b 100644
--- a/kernel/dma/pool.c
+++ b/kernel/dma/pool.c
@@ -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;
-- 
2.52.0


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

* Re: [PATCH] dma/pool: eliminate alloc_pages warning in atomic_pool_expand
  2025-12-02 15:28 ` [PATCH] dma/pool: eliminate alloc_pages warning in atomic_pool_expand Dave Kleikamp
@ 2025-12-02 15:47   ` Robin Murphy
  2025-12-02 15:49     ` Dave Kleikamp
  2025-12-08  8:41   ` Marek Szyprowski
  1 sibling, 1 reply; 4+ messages in thread
From: Robin Murphy @ 2025-12-02 15:47 UTC (permalink / raw)
  To: Dave Kleikamp, Marek Szyprowski; +Cc: iommu, linux-kernel

On 2025-12-02 3:28 pm, Dave Kleikamp wrote:
> atomic_pool_expand iterately tries the allocation while decrementing the

"iteratively"?

> page order. There is no need to issue a warning if an attempted
> allocation fails.
> 
> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> ---
>   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 ee45dee33d49..26392badc36b 100644
> --- a/kernel/dma/pool.c
> +++ b/kernel/dma/pool.c
> @@ -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;

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

>   	} while (!page && order-- > 0);
>   	if (!page)
>   		goto out;


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

* Re: [PATCH] dma/pool: eliminate alloc_pages warning in atomic_pool_expand
  2025-12-02 15:47   ` Robin Murphy
@ 2025-12-02 15:49     ` Dave Kleikamp
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Kleikamp @ 2025-12-02 15:49 UTC (permalink / raw)
  To: Robin Murphy, Marek Szyprowski; +Cc: iommu, linux-kernel

On 12/2/25 9:47AM, Robin Murphy wrote:
> On 2025-12-02 3:28 pm, Dave Kleikamp wrote:
>> atomic_pool_expand iterately tries the allocation while decrementing the
> 
> "iteratively"?

Oops.

> 
>> page order. There is no need to issue a warning if an attempted
>> allocation fails.
>>
>> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
>> ---
>>   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 ee45dee33d49..26392badc36b 100644
>> --- a/kernel/dma/pool.c
>> +++ b/kernel/dma/pool.c
>> @@ -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;
> 
> Reviewed-by: Robin Murphy <robin.murphy@arm.com>

Thanks

> 
>>       } while (!page && order-- > 0);
>>       if (!page)
>>           goto out;
> 


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

* Re: [PATCH] dma/pool: eliminate alloc_pages warning in atomic_pool_expand
  2025-12-02 15:28 ` [PATCH] dma/pool: eliminate alloc_pages warning in atomic_pool_expand Dave Kleikamp
  2025-12-02 15:47   ` Robin Murphy
@ 2025-12-08  8:41   ` Marek Szyprowski
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Szyprowski @ 2025-12-08  8:41 UTC (permalink / raw)
  To: Dave Kleikamp, Robin Murphy; +Cc: iommu, linux-kernel

On 02.12.2025 16:28, Dave Kleikamp wrote:
> 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.
>
> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>

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.

> ---
>   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 ee45dee33d49..26392badc36b 100644
> --- a/kernel/dma/pool.c
> +++ b/kernel/dma/pool.c
> @@ -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
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

end of thread, other threads:[~2025-12-08  8:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20251202152846eucas1p201ac63a0baab0ac4ead2fb25fdbaf1e0@eucas1p2.samsung.com>
2025-12-02 15:28 ` [PATCH] dma/pool: eliminate alloc_pages warning in atomic_pool_expand Dave Kleikamp
2025-12-02 15:47   ` Robin Murphy
2025-12-02 15:49     ` Dave Kleikamp
2025-12-08  8:41   ` Marek Szyprowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).