Commit f3b52167 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

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.

Reviewed-by: default avatarMina Almasry <almasrymina@google.com>
Link: https://patch.msgid.link/20250912161703.361272-1-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3a0ac202
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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));