From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>, <netdev@vger.kernel.org>
Subject: [PATCH v2 net-next 0/4] rtnetlink: Per-netns RTNL.
Date: Wed, 2 Oct 2024 08:12:36 -0700 [thread overview]
Message-ID: <20241002151240.49813-1-kuniyu@amazon.com> (raw)
rtnl_lock() is a "Big Kernel Lock" in the networking slow path and
serialised all rtnetlink requests until 4.13.
Since RTNL_FLAG_DOIT_UNLOCKED and RTNL_FLAG_DUMP_UNLOCKED have been
introduced in 4.14 and 6.9, respectively, rtnetlink message handlers
are ready to be converted to RTNL-less/free.
15 out of 44 dumpit()s have been converted to RCU so far, and the
progress is pretty good. We can now dump various major network
resources without RTNL.
12 out of 87 doit()s have been converted, but most of the converted
doit()s are also on the reader side of RTNL; their message types are
RTM_GET*.
So, most of RTM_(NEW|DEL|SET)* operations are still serialised by RTNL.
For example, one of our services creates 2K netns and a small number
of network interfaces in each netns that require too many writer-side
rtnetlink requests, and setting up a single host takes 10+ minutes.
RTNL is still a huge pain for network configuration paths, and we need
more granular locking, given converting all doit()s would be unfeasible.
Actually, most RTNL users do not need to freeze multiple netns, and such
users can be protected by per-netns RTNL mutex. The exceptions would be
RTM_NEWLINK, RTM_DELLINK, and RTM_SETLINK. (See [0])
This series is the first step of the per-netns RTNL conversion that
gradually replaces rtnl_lock() with rtnl_net_lock(net) under
CONFIG_DEBUG_NET_SMALL_RTNL.
[0]: https://lpc.events/event/18/contributions/1959/
Changes:
v2:
* Add revert of 464eb03c4a7c
* Fix Kconfig dependency for arch with no lockdep support
v1: https://lore.kernel.org/netdev/20240930202524.59357-1-kuniyu@amazon.com/
Kuniyuki Iwashima (4):
Revert "rtnetlink: add guard for RTNL"
rtnetlink: Add per-netns RTNL.
rtnetlink: Add assertion helpers for per-netns RTNL.
rtnetlink: Add ASSERT_RTNL_NET() placeholder for netdev notifier.
include/linux/rtnetlink.h | 39 ++++++++++-
include/net/net_namespace.h | 4 ++
net/Kconfig.debug | 15 +++++
net/core/Makefile | 1 +
net/core/net_namespace.c | 6 ++
net/core/rtnetlink.c | 70 +++++++++++++++++++
net/core/rtnl_net_debug.c | 131 ++++++++++++++++++++++++++++++++++++
7 files changed, 264 insertions(+), 2 deletions(-)
create mode 100644 net/core/rtnl_net_debug.c
--
2.30.2
next reply other threads:[~2024-10-02 15:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 15:12 Kuniyuki Iwashima [this message]
2024-10-02 15:12 ` [PATCH v2 net-next 1/4] Revert "rtnetlink: add guard for RTNL" Kuniyuki Iwashima
2024-10-02 15:14 ` Eric Dumazet
2024-10-02 15:12 ` [PATCH v2 net-next 2/4] rtnetlink: Add per-netns RTNL Kuniyuki Iwashima
2024-10-04 11:08 ` Eric Dumazet
2024-10-04 20:21 ` Jakub Kicinski
2024-10-04 20:45 ` Kuniyuki Iwashima
2024-10-04 20:51 ` Kuniyuki Iwashima
2024-10-04 20:59 ` Eric Dumazet
2024-10-04 21:22 ` Kuniyuki Iwashima
2024-10-02 15:12 ` [PATCH v2 net-next 3/4] rtnetlink: Add assertion helpers for " Kuniyuki Iwashima
2024-10-04 11:10 ` Eric Dumazet
2024-10-02 15:12 ` [PATCH v2 net-next 4/4] rtnetlink: Add ASSERT_RTNL_NET() placeholder for netdev notifier Kuniyuki Iwashima
2024-10-04 11:14 ` Eric Dumazet
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=20241002151240.49813-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).