]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dma/pool: distinguish between missing and exhausted atomic pools
authorSai Sree Kartheek Adivi <s-adivi@ti.com>
Wed, 28 Jan 2026 13:35:54 +0000 (19:05 +0530)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 29 Jan 2026 09:23:45 +0000 (10:23 +0100)
commit56c430c7f06d838fe3b2077dbbc4cc0bf992312b
treef923da4494bc3781e278db4745887bb44215eb5d
parent0fd17e5983337231dc655e9ca0095d2ca3f47405
dma/pool: distinguish between missing and exhausted atomic pools

Currently, dma_alloc_from_pool() unconditionally warns and dumps a stack
trace when an allocation fails, with the message "Failed to get suitable
pool".

This conflates two distinct failure modes:
1. Configuration error: No atomic pool is available for the requested
   DMA mask (a fundamental system setup issue)
2. Resource Exhaustion: A suitable pool exists but is currently full (a
   recoverable runtime state)

This lack of distinction prevents drivers from using __GFP_NOWARN to
suppress error messages during temporary pressure spikes, such as when
awaiting synchronous reclaim of descriptors.

Refactor the error handling to distinguish these cases:
- If no suitable pool is found, keep the unconditional WARN regarding
  the missing pool.
- If a pool was found but is exhausted, respect __GFP_NOWARN and update
  the warning message to explicitly state "DMA pool exhausted".

Fixes: 9420139f516d ("dma-pool: fix coherent pool allocations for IOMMU mappings")
Signed-off-by: Sai Sree Kartheek Adivi <s-adivi@ti.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20260128133554.3056582-1-s-adivi@ti.com
kernel/dma/pool.c