diff mbox series

[net-next,10/11] net-sysfs: remove the rtnl lock when accessing the xps maps

Message ID 20210128144405.4157244-11-atenart@kernel.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: xps: improve the xps maps handling | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 3 maintainers not CCed: edumazet@google.com alexanderduyck@fb.com christian.brauner@ubuntu.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 35 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Antoine Tenart Jan. 28, 2021, 2:44 p.m. UTC
Now that nr_ids and num_tc are stored in the xps dev_maps, which are RCU
protected, we do not have the need to protect the xps_queue_show
function with the rtnl lock.

Signed-off-by: Antoine Tenart <atenart@kernel.org>
---
 net/core/net-sysfs.c | 15 ---------------
 1 file changed, 15 deletions(-)
diff mbox series

Patch

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 0c564f288460..08c7a494d0e1 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1314,7 +1314,6 @@  static const struct attribute_group dql_group = {
 #endif /* CONFIG_BQL */
 
 #ifdef CONFIG_XPS
-/* Should be called with the rtnl lock held. */
 static int xps_queue_show(struct net_device *dev, unsigned long **mask,
 			  unsigned int index, bool is_rxqs_map)
 {
@@ -1375,14 +1374,7 @@  static ssize_t xps_cpus_show(struct netdev_queue *queue, char *buf)
 	if (!mask)
 		return -ENOMEM;
 
-	if (!rtnl_trylock()) {
-		bitmap_free(mask);
-		return restart_syscall();
-	}
-
 	ret = xps_queue_show(dev, &mask, index, false);
-	rtnl_unlock();
-
 	if (ret) {
 		bitmap_free(mask);
 		return ret;
@@ -1447,14 +1439,7 @@  static ssize_t xps_rxqs_show(struct netdev_queue *queue, char *buf)
 	if (!mask)
 		return -ENOMEM;
 
-	if (!rtnl_trylock()) {
-		bitmap_free(mask);
-		return restart_syscall();
-	}
-
 	ret = xps_queue_show(dev, &mask, index, true);
-	rtnl_unlock();
-
 	if (ret) {
 		bitmap_free(mask);
 		return ret;