Skip to contentSkip to conversation

page_pool: always add GFP_NOWARN for ATOMIC allocations

PATCH Applied Jakub Kicinski 2 participants 2 messages Sep 12, 2025 – Sep 16, 2025

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH v2 1/1 page_pool: always add GFP_NOWARN for ATOMIC allocations

Driver authors often forget to add GFP_NOWARN for page allocation from the datapath. This is annoying to users as OOMs are a fact of life, and we pretty much expect network Rx to hit page allocation failures during OOM. Make page pool add GFP_NOWARN for ATOMIC allocations by default.

---
v2:
- drop the micro-optimization
v1: https://lore.kernel.org/[email protected]

---
 net/core/page_pool.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/core/page_pool.c +6 -0
index ba70569bd4b0..36a98f2bcac3 100644
@@ -555,6 +555,12 @@ static noinline netmem_ref __page_pool_alloc_netmems_slow(struct page_pool *pool
 	netmem_ref netmem;
 	int i, nr_pages;
 
+	/* Unconditionally set NOWARN if allocating from NAPI.
+	 * Drivers forget to set it, and OOM reports on packet Rx are useless.
+	 */
+	if ((gfp & GFP_ATOMIC) == GFP_ATOMIC)
+		gfp |= __GFP_NOWARN;
+
 	/* Don't support bulk alloc for high-order pages */
 	if (unlikely(pp_order))
 		return page_to_netmem(__page_pool_alloc_page_order(pool, gfp));
Signature · 1 line
2.51.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Fri, 12 Sep 2025 09:17:03 -0700 you wrote:

Driver authors often forget to add GFP_NOWARN for page allocation from the datapath. This is annoying to users as OOMs are a fact of life, and we pretty much expect network Rx to hit page allocation failures during OOM. Make page pool add GFP_NOWARN for ATOMIC allocations by default.

[...]

Here is the summary with links:
- [net-next,v2] page_pool: always add GFP_NOWARN for ATOMIC allocations

    https://git.kernel.org/netdev/net-next/c/f3b52167a0cb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html