[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240227150200.2814664-13-edumazet@google.com>
Date: Tue, 27 Feb 2024 15:01:57 +0000
From: Eric Dumazet <edumazet@...gle.com>
To: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: David Ahern <dsahern@...nel.org>, Jiri Pirko <jiri@...dia.com>, netdev@...r.kernel.org,
eric.dumazet@...il.com, Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH v2 net-next 12/15] ipv6: addrconf_disable_policy() optimization
Writing over /proc/sys/net/ipv6/conf/default/disable_policy
does not need to hold RTNL.
Signed-off-by: Eric Dumazet <edumazet@...gle.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 392e64df991a4005736883af128cd82ac3895167..d198365b1ac669a1158c44c1c9d050ede276d638 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6691,20 +6691,19 @@ void addrconf_disable_policy_idev(struct inet6_dev *idev, int val)
static
int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val)
{
+ struct net *net = (struct net *)ctl->extra2;
struct inet6_dev *idev;
- struct net *net;
+
+ if (valp == &net->ipv6.devconf_dflt->disable_policy) {
+ WRITE_ONCE(*valp, val);
+ return 0;
+ }
if (!rtnl_trylock())
return restart_syscall();
WRITE_ONCE(*valp, val);
- net = (struct net *)ctl->extra2;
- if (valp == &net->ipv6.devconf_dflt->disable_policy) {
- rtnl_unlock();
- return 0;
- }
-
if (valp == &net->ipv6.devconf_all->disable_policy) {
struct net_device *dev;
--
2.44.0.rc1.240.g4c46232300-goog
Powered by blists - more mailing lists