mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Andrew Lunn <andrew+netdev@lunn.ch>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 gustavold@gmail.com, asantostc@gmail.com,
	Breno Leitao <leitao@debian.org>,
	 kernel-team@meta.com
Subject: [PATCH 0/9] netconsole: stop charging every netpoll user for netconsole-only state
Date: Sun, 24 May 2026 09:12:16 -0700	[thread overview]
Message-ID: <20260524-netconsole_move_more-v1-0-909d1ab398b4@debian.org> (raw)

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.
  - local_ip / remote_ip / ipv6: the source and destination IP
    addresses and the family selector for the same packets.

Every netpoll user that allocates a struct netpoll and 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.

The fix is to move 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 genuinely belongs to the generic poll/transmit
abstraction or what netpoll core still has to read itself.

Follow-ups
----------

local_ip, remote_ip and ipv6 are still in struct netpoll, as they are
left for a follow-up posting to keep each series focused on a single
responsibility transfer.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (9):
      netpoll: export refill_skbs(), refill_skbs_work_handler(), skb_pool_flush()
      netconsole: take over skb pool lifecycle from netpoll
      netconsole: move refill_skbs_work_handler() from netpoll
      netconsole: move refill_skbs() and skb-pool sizing macros from netpoll
      netconsole: move skb_pool_flush() from netpoll
      netconsole: move skb_pool / refill_wq from struct netpoll to netconsole_target
      netconsole: move local_port from struct netpoll to netconsole_target
      netconsole: move remote_port from struct netpoll to netconsole_target
      netconsole: move remote_mac from struct netpoll to netconsole_target

 drivers/net/netconsole.c | 188 ++++++++++++++++++++++++++++++++++++-----------
 include/linux/netpoll.h  |   4 -
 net/core/netpoll.c       |  58 +--------------
 3 files changed, 145 insertions(+), 105 deletions(-)
---
base-commit: 150061a2065192d77a4f6518b6238be81dfb8321
change-id: 20260514-netconsole_move_more-888fde03dfc7

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


             reply	other threads:[~2026-05-24 16:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24 16:12 Breno Leitao [this message]
2026-05-24 16:12 ` [PATCH 1/9] netpoll: export refill_skbs(), refill_skbs_work_handler(), skb_pool_flush() Breno Leitao
2026-05-24 16:12 ` [PATCH 2/9] netconsole: take over skb pool lifecycle from netpoll Breno Leitao
2026-05-24 16:12 ` [PATCH 3/9] netconsole: move refill_skbs_work_handler() " Breno Leitao
2026-05-24 16:12 ` [PATCH 4/9] netconsole: move refill_skbs() and skb-pool sizing macros " Breno Leitao
2026-05-24 16:12 ` [PATCH 5/9] netconsole: move skb_pool_flush() " Breno Leitao
2026-05-24 16:12 ` [PATCH 6/9] netconsole: move skb_pool / refill_wq from struct netpoll to netconsole_target Breno Leitao
2026-05-24 16:12 ` [PATCH 7/9] netconsole: move local_port " Breno Leitao
2026-05-24 16:12 ` [PATCH 8/9] netconsole: move remote_port " Breno Leitao
2026-05-24 16:12 ` [PATCH 9/9] netconsole: move remote_mac " Breno Leitao
2026-05-27  2:00 ` [PATCH 0/9] netconsole: stop charging every netpoll user for netconsole-only state Jakub Kicinski
2026-05-27  9:07   ` Breno Leitao
2026-05-27 13:22     ` Breno Leitao
2026-05-27 22:59       ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260524-netconsole_move_more-v1-0-909d1ab398b4@debian.org \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=asantostc@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavold@gmail.com \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®