summaryrefslogtreecommitdiff
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-05-02 17:39:26 +0000
committerJakub Kicinski <kuba@kernel.org>2024-05-03 15:14:01 -0700
commitc1742dcb6bda5fd535fbaa2145f0a180bc329aa6 (patch)
tree2552435caf76a6cf8dd78f0d734c953b517ace36 /net/core/dev.c
parent3e51f2cbbc5dc854f89ca37d95d295bfcabb5b43 (diff)
net: no longer acquire RTNL in threaded_show()
dev->threaded can be read locklessly, if we add corresponding READ_ONCE()/WRITE_ONCE() annotations. Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20240502173926.2010646-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index e02d2363347e..d6b24749eb2e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6531,7 +6531,7 @@ int dev_set_threaded(struct net_device *dev, bool threaded)
}
}
- dev->threaded = threaded;
+ WRITE_ONCE(dev->threaded, threaded);
/* Make sure kthread is created before THREADED bit
* is set.
@@ -6622,7 +6622,7 @@ void netif_napi_add_weight(struct net_device *dev, struct napi_struct *napi,
* threaded mode will not be enabled in napi_enable().
*/
if (dev->threaded && napi_kthread_create(napi))
- dev->threaded = 0;
+ dev->threaded = false;
netif_napi_set_irq(napi, -1);
}
EXPORT_SYMBOL(netif_napi_add_weight);