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
State New
Headers show
Series [net-next,01/11] net-sysfs: convert xps_cpus_show to bitmap_zalloc | expand

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;