From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, Jiri Pirko <jiri@nvidia.com>,
David Ahern <dsahern@kernel.org>,
eric.dumazet@gmail.com, Eric Dumazet <edumazet@google.com>
Subject: [PATCH v3 net-next 03/15] ipv6: addrconf_disable_ipv6() optimization
Date: Wed, 28 Feb 2024 13:54:27 +0000 [thread overview]
Message-ID: <20240228135439.863861-4-edumazet@google.com> (raw)
In-Reply-To: <20240228135439.863861-1-edumazet@google.com>
Writing over /proc/sys/net/ipv6/conf/default/disable_ipv6
does not need to hold RTNL.
v3: remove a wrong change (Jakub Kicinski feedback)
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
net/ipv6/addrconf.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 9c1d141a9a343b45225658ce75f23893ff6c7426..9a5182a12bfd7719fa6d5f0537835e0f0bf37686 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6398,21 +6398,20 @@ static void addrconf_disable_change(struct net *net, __s32 newf)
static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int newf)
{
- struct net *net;
+ struct net *net = (struct net *)table->extra2;
int old;
+ if (p == &net->ipv6.devconf_dflt->disable_ipv6) {
+ WRITE_ONCE(*p, newf);
+ return 0;
+ }
+
if (!rtnl_trylock())
return restart_syscall();
- net = (struct net *)table->extra2;
old = *p;
WRITE_ONCE(*p, newf);
- if (p == &net->ipv6.devconf_dflt->disable_ipv6) {
- rtnl_unlock();
- return 0;
- }
-
if (p == &net->ipv6.devconf_all->disable_ipv6) {
WRITE_ONCE(net->ipv6.devconf_dflt->disable_ipv6, newf);
addrconf_disable_change(net, newf);
--
2.44.0.rc1.240.g4c46232300-goog
next prev parent reply other threads:[~2024-02-28 13:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 13:54 [PATCH v3 net-next 00/15] ipv6: lockless accesses to devconf Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 01/15] ipv6: add ipv6_devconf_read_txrx cacheline_group Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 02/15] ipv6: annotate data-races around cnf.disable_ipv6 Eric Dumazet
2024-02-28 13:54 ` Eric Dumazet [this message]
2024-02-28 13:54 ` [PATCH v3 net-next 04/15] ipv6: annotate data-races around cnf.mtu6 Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 05/15] ipv6: annotate data-races around cnf.hop_limit Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 06/15] ipv6: annotate data-races around cnf.forwarding Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 07/15] ipv6: annotate data-races in ndisc_router_discovery() Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 08/15] ipv6: annotate data-races around idev->cnf.ignore_routes_with_linkdown Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 09/15] ipv6: annotate data-races in rt6_probe() Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 10/15] ipv6: annotate data-races around devconf->proxy_ndp Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 11/15] ipv6: annotate data-races around devconf->disable_policy Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 12/15] ipv6: addrconf_disable_policy() optimization Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 13/15] ipv6/addrconf: annotate data-races around devconf fields (I) Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 14/15] ipv6/addrconf: annotate data-races around devconf fields (II) Eric Dumazet
2024-02-28 13:54 ` [PATCH v3 net-next 15/15] ipv6: use xa_array iterator to implement inet6_netconf_dump_devconf() Eric Dumazet
2024-03-01 8:50 ` [PATCH v3 net-next 00/15] ipv6: lockless accesses to devconf patchwork-bot+netdevbpf
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=20240228135439.863861-4-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=eric.dumazet@gmail.com \
--cc=jiri@nvidia.com \
--cc=kuba@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;
as well as URLs for NNTP newsgroup(s).