]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: Remove redundant rcu_read_lock/unlock() in spin_lock
authorpengdonglin <pengdonglin@xiaomi.com>
Tue, 16 Sep 2025 04:47:31 +0000 (12:47 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 19 Sep 2025 09:48:14 +0000 (11:48 +0200)
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: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: pengdonglin <pengdonglin@xiaomi.com>
Signed-off-by: pengdonglin <dolinux.peng@gmail.com>
Link: https://patch.msgid.link/20250916044735.2316171-11-dolinux.peng@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c
net/mac80211/debugfs.c
net/mac80211/debugfs_netdev.c
net/mac80211/debugfs_sta.c
net/mac80211/sta_info.c

index da15ccfcf4a2a536132545220f0ff0c9981498ef..d9aca1c3c097eb13dc2e5a5c179bf83c35ad202b 100644 (file)
@@ -4935,7 +4935,6 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy,
        int ret = 0;
 
        spin_lock_bh(&local->fq.lock);
-       rcu_read_lock();
 
        if (wdev) {
                sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
@@ -4961,7 +4960,6 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy,
        }
 
 out:
-       rcu_read_unlock();
        spin_unlock_bh(&local->fq.lock);
 
        return ret;
index e8b78ec682da8e30855898e102176d887a8346c6..82099f4cedbe06de266c2edaf0508b14d2abc977 100644 (file)
@@ -82,7 +82,6 @@ static ssize_t aqm_read(struct file *file,
        int len = 0;
 
        spin_lock_bh(&local->fq.lock);
-       rcu_read_lock();
 
        len = scnprintf(buf, sizeof(buf),
                        "access name value\n"
@@ -105,7 +104,6 @@ static ssize_t aqm_read(struct file *file,
                        fq->limit,
                        fq->quantum);
 
-       rcu_read_unlock();
        spin_unlock_bh(&local->fq.lock);
 
        return simple_read_from_buffer(user_buf, count, ppos,
index 1dac78271045a9f9f6201e791d3471f2f8df83d1..30a5a978a678c1d97cf1befea5220ec3c14d844d 100644 (file)
@@ -625,7 +625,6 @@ static ssize_t ieee80211_if_fmt_aqm(
        txqi = to_txq_info(sdata->vif.txq);
 
        spin_lock_bh(&local->fq.lock);
-       rcu_read_lock();
 
        len = scnprintf(buf,
                        buflen,
@@ -642,7 +641,6 @@ static ssize_t ieee80211_if_fmt_aqm(
                        txqi->tin.tx_bytes,
                        txqi->tin.tx_packets);
 
-       rcu_read_unlock();
        spin_unlock_bh(&local->fq.lock);
 
        return len;
index 49061bd4151bcf1884c6c2c65f8bcaae46bff2c3..ef75255d47d5a065cc41517070e1aff8f45bf385 100644 (file)
@@ -148,7 +148,6 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf,
                return -ENOMEM;
 
        spin_lock_bh(&local->fq.lock);
-       rcu_read_lock();
 
        p += scnprintf(p,
                       bufsz + buf - p,
@@ -178,7 +177,6 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf,
                               test_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) ? " DIRTY" : "");
        }
 
-       rcu_read_unlock();
        spin_unlock_bh(&local->fq.lock);
 
        rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
index 1bd75e0375a0276155829c5602b7503f5ea7c398..f4d3b67fda062d1773f0d51c44b3495aba47bea0 100644 (file)
@@ -2637,13 +2637,11 @@ static void sta_set_tidstats(struct sta_info *sta,
 
        if (link_id < 0 && tid < IEEE80211_NUM_TIDS) {
                spin_lock_bh(&local->fq.lock);
-               rcu_read_lock();
 
                tidstats->filled |= BIT(NL80211_TID_STATS_TXQ_STATS);
                ieee80211_fill_txq_stats(&tidstats->txq_stats,
                                         to_txq_info(sta->sta.txq[tid]));
 
-               rcu_read_unlock();
                spin_unlock_bh(&local->fq.lock);
        }
 }