Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures
@ 2026-06-29 11:45 Breno Leitao
  2026-06-29 11:45 ` [PATCH net-next 1/2] netconsole: do not warn when the best-effort skb allocation fails Breno Leitao
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Breno Leitao @ 2026-06-29 11:45 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: netdev, linux-kernel, asantostc, gustavold, vlad.wing,
	Breno Leitao, kernel-team

Both netconsole and netpoll keep a small preallocated pool of skbs
(skb_pool) so they can still get a buffer under memory pressure.

On the hot path they first attempt a normal GFP_ATOMIC allocation and only
fall back to the pool when that fails, keeping the pool as a last resort.

This is where the problem happens. If alloc_skb() fails, we now have
more than 100 message coming from the page=0 failure, which consumes the
scarce pool of skb, making the real issue disappear.

So the noise (memory allocation failure) deplets the SKB buffer and crowds out
the real message we were trying to deliver.

This is happening on the Meta fleet. The stack trace looks like:

  pr/netcon_ext0: page allocation failure: order:0, mode:0x40820(GFP_ATOMIC|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
  ...
  dump_stack_lvl
  warn_alloc
  __alloc_pages_slowpath
  __alloc_frozen_pages_noprof
  alloc_pages_mpol
  alloc_slab_page
  allocate_slab
  kmem_cache_alloc_node_noprof
  __alloc_skb
  send_udp
  netconsole_write
  nbcon_emit_next_record
  nbcon_emit_one
  nbcon_kthread_func
  kthread

Solution: Do not warn if netconsole/netpoll fails to allocate these SKBs. Pass
__GFP_NOWARN on these best-effort allocations -- both the hot-path attempt in
netconsole's find_skb() and the pool refill in netpoll's refill_skbs() -- and
let the existing fallback paths do their job quietly. The allocation will
happen on SKB refill workqueue.

Given I am touching this code, if alloc_skb() fails, reschedule the
workqueue to try later.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (2):
      netconsole: do not warn when the best-effort skb allocation fails
      netpoll: do not warn when the best-effort pool refill fails

 drivers/net/netconsole.c | 2 +-
 net/core/netpoll.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 3d5670d672ae08b8c534b7beed6f57c8b44e7b43
change-id: 20260629-netpoll_no_warn-20174d15bcd3

Best regards,
-- 
Breno Leitao <leitao@debian.org>


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

* [PATCH net-next 1/2] netconsole: do not warn when the best-effort skb allocation fails
  2026-06-29 11:45 [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures Breno Leitao
@ 2026-06-29 11:45 ` Breno Leitao
  2026-06-29 11:45 ` [PATCH net-next 2/2] netpoll: do not warn when the best-effort pool refill fails Breno Leitao
  2026-07-01  0:20 ` [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2026-06-29 11:45 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: netdev, linux-kernel, asantostc, gustavold, vlad.wing,
	Breno Leitao, kernel-team

find_skb() allocates the skb with GFP_ATOMIC as a best-effort attempt:
on failure it falls back to the preallocated skb pool and, failing that,
polls the device and retries. The allocation failing is therefore an
expected and fully handled condition, but without __GFP_NOWARN the page
allocator still emits a warn_alloc() splat with a full stack trace on
every miss, which then consumes the whole SKB pool, that would be useful
printing the real issue rather than the memory failure.

Pass __GFP_NOWARN so the best-effort allocation stays quiet and lets the
existing fallback path do its job.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/netconsole.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 862001d09aa84..c1812a98365b7 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1737,7 +1737,7 @@ static struct sk_buff *find_skb(struct netpoll *np, int len, int reserve)
 	netpoll_zap_completion_queue();
 repeat:
 
-	skb = alloc_skb(len, GFP_ATOMIC);
+	skb = alloc_skb(len, GFP_ATOMIC | __GFP_NOWARN);
 	if (!skb)
 		skb = netcons_skb_pop(np, len);
 

-- 
2.53.0-Meta


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

* [PATCH net-next 2/2] netpoll: do not warn when the best-effort pool refill fails
  2026-06-29 11:45 [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures Breno Leitao
  2026-06-29 11:45 ` [PATCH net-next 1/2] netconsole: do not warn when the best-effort skb allocation fails Breno Leitao
@ 2026-06-29 11:45 ` Breno Leitao
  2026-07-01  0:20 ` [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2026-06-29 11:45 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: netdev, linux-kernel, asantostc, gustavold, vlad.wing,
	Breno Leitao, kernel-team

refill_skbs() tops up the per-netpoll skb pool with GFP_ATOMIC and
simply stops on the first allocation failure, leaving the pool partially
filled; a later refill tops it up once memory frees up. The allocation
failing is therefore an expected and fully handled condition, but
without __GFP_NOWARN the page allocator emits a warn_alloc() splat with
a full stack trace on every miss.

Pass __GFP_NOWARN so the best-effort refill stays quiet, mirroring the
same change in netconsole's find_skb().

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 net/core/netpoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 229dde818ab33..85aa513508811 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -221,7 +221,7 @@ static void refill_skbs(struct netpoll *np)
 	skb_pool = &np->skb_pool;
 
 	while (READ_ONCE(skb_pool->qlen) < MAX_SKBS) {
-		skb = alloc_skb(MAX_SKB_SIZE, GFP_ATOMIC);
+		skb = alloc_skb(MAX_SKB_SIZE, GFP_ATOMIC | __GFP_NOWARN);
 		if (!skb)
 			break;
 

-- 
2.53.0-Meta


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

* Re: [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures
  2026-06-29 11:45 [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures Breno Leitao
  2026-06-29 11:45 ` [PATCH net-next 1/2] netconsole: do not warn when the best-effort skb allocation fails Breno Leitao
  2026-06-29 11:45 ` [PATCH net-next 2/2] netpoll: do not warn when the best-effort pool refill fails Breno Leitao
@ 2026-07-01  0:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-01  0:20 UTC (permalink / raw)
  To: Breno Leitao
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, horms, netdev,
	linux-kernel, asantostc, gustavold, vlad.wing, kernel-team

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 29 Jun 2026 04:45:39 -0700 you wrote:
> Both netconsole and netpoll keep a small preallocated pool of skbs
> (skb_pool) so they can still get a buffer under memory pressure.
> 
> On the hot path they first attempt a normal GFP_ATOMIC allocation and only
> fall back to the pool when that fails, keeping the pool as a last resort.
> 
> This is where the problem happens. If alloc_skb() fails, we now have
> more than 100 message coming from the page=0 failure, which consumes the
> scarce pool of skb, making the real issue disappear.
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] netconsole: do not warn when the best-effort skb allocation fails
    https://git.kernel.org/netdev/net-next/c/09f7a613a14f
  - [net-next,2/2] netpoll: do not warn when the best-effort pool refill fails
    https://git.kernel.org/netdev/net-next/c/84c0ff1efb62

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-07-01  0:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 11:45 [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures Breno Leitao
2026-06-29 11:45 ` [PATCH net-next 1/2] netconsole: do not warn when the best-effort skb allocation fails Breno Leitao
2026-06-29 11:45 ` [PATCH net-next 2/2] netpoll: do not warn when the best-effort pool refill fails Breno Leitao
2026-07-01  0:20 ` [PATCH net-next 0/2] net: do not warn on best-effort skb allocation failures patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox