Re: [PATCH net-next v3 0/9] netconsole: stop charging netpoll users for netconsole-only data
From: Simon Horman
Date: Thu Jul 16 2026 - 09:21:59 EST
On Fri, Jul 10, 2026 at 04:38:52AM -0700, Breno Leitao wrote:
> This work continue to untangle netconsole and netpoll, improving
> memory usage for netpoll users that are not netconsole.
>
> struct netpoll is shared by every netpoll consumer in the tree:
> bonding, bridge, team, vlan, macvlan, dsa and netconsole. The non-
> netconsole users only need a per-port handle that lets them transmit
> SKBs.
>
> Yet struct netpoll has accumulated a pile of fields that exist only
> to serve netconsole's printk path:
>
> - skb_pool / refill_wq: the fallback skb pool find_skb() falls back
> on when alloc_skb() returns NULL, plus the workqueue that refills
> it.
> - local_port / remote_port / remote_mac: the source and destination
> UDP ports and the destination ethernet address used to build
> outgoing log packets.
>
> Every netpoll user that allocates a struct netpoll pays for all of
> these fields, even though it never queues a single skb on the pool,
> never sends a UDP frame and never looks at any of the addressing.
>
> Move this netconsole-only state out of the shared struct into struct
> netconsole_target, where its only consumer already lives.
>
> After the series every passive netpoll consumer drops
> sizeof(sk_buff_head) + sizeof(work_struct) + 2 * sizeof(u16) +
> ETH_ALEN bytes per port (plus padding), and struct netpoll keeps only
> what belongs to the generic poll/transmit abstraction or what netpoll
> core still reads itself.
>
> Follow-ups
> ----------
> local_ip, remote_ip and ipv6 are still in struct netpoll. Moving the
> addressing additionally requires relocating netpoll_setup() -- whose
> only caller is netconsole -- and its IPv4/IPv6 helpers, so it is left
> for a follow-up to keep this series focused on a single responsibility
> transfer.
>
> This is pure code motion with no functional change. The pre-existing
> target/device teardown races reported against v1 have since been fixed
> independently (as suggested by Jakub) and are already in the tree, so,
> re-posting this one.
>
> --
>
> Changes in v3:
> - Added a fix for a pre-existing cleanup-skip leak (released/joined targets).
> - Added an skb-pool init-once patch closing an init/teardown race; rebased.
> - Link to v2: https://lore.kernel.org/r/20260702-netconsole_move_more-v2-0-1ebedd921dcb@xxxxxxxxxx
>
> Changes in v2:
> - Rebase on net-next, now that the prerequisite netconsole
> teardown-race fixes are merged.
> - Squash the local_port and remote_port moves into a single patch.
> - v1: https://lore.kernel.org/r/20260524-netconsole_move_more-v1-0-909d1ab398b4@xxxxxxxxxx
For the series:
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>