[PATCH v3 13/14] net: bonding: Remove redundant rcu_read_lock/unlock() in spin_lock
pengdonglin
dolinux.peng at gmail.com
Tue Sep 16 04:47:34 UTC 2025
From: pengdonglin <pengdonglin at xiaomi.com>
Since commit a8bb74acd8efe ("rcu: Consolidate RCU-sched update-side function definitions")
there is no difference between rcu_read_lock(), rcu_read_lock_bh() and
rcu_read_lock_sched() in terms of RCU read section and the relevant grace
period. That means that spin_lock(), which implies rcu_read_lock_sched(),
also implies rcu_read_lock().
There is no need no explicitly start a RCU read section if one has already
been started implicitly by spin_lock().
Simplify the code and remove the inner rcu_read_lock() invocation.
Cc: Jay Vosburgh <jv at jvosburgh.net>
Cc: Paolo Abeni <pabeni at redhat.com>
Cc: Jakub Kicinski <kuba at kernel.org>
Signed-off-by: pengdonglin <pengdonglin at xiaomi.com>
Signed-off-by: pengdonglin <dolinux.peng at gmail.com>
---
drivers/net/bonding/bond_3ad.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 4edc8e6b6b64..c53ea73f103a 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2485,7 +2485,6 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
* concurrently due to incoming LACPDU as well.
*/
spin_lock_bh(&bond->mode_lock);
- rcu_read_lock();
/* check if there are any slaves */
if (!bond_has_slaves(bond))
@@ -2537,7 +2536,6 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
break;
}
}
- rcu_read_unlock();
spin_unlock_bh(&bond->mode_lock);
if (update_slave_arr)
--
2.34.1
More information about the Linux-security-module-archive
mailing list