From: Matthieu Baerts (NGI0) Date: Mon, 4 Nov 2024 12:43:47 +0000 (+0100) Subject: mptcp: remove unneeded lock when listing scheds X-Git-Tag: v6.13-rc1~135^2~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2c71c49da8f8941e3e465605fc41939eee9210a;p=thirdparty%2Fkernel%2Flinux.git mptcp: remove unneeded lock when listing scheds mptcp_get_available_schedulers() needs to iterate over the schedulers' list only to read the names: it doesn't modify anything there. In this case, it is enough to hold the RCU read lock, no need to combine this with the associated spin lock as it was done since its introduction in commit 73c900aa3660 ("mptcp: add net.mptcp.available_schedulers"). Suggested-by: Paolo Abeni Reviewed-by: Geliang Tang Reviewed-by: Simon Horman Signed-off-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20241104-net-next-mptcp-sched-unneeded-lock-v2-1-2ccc1e0c750c@kernel.org Signed-off-by: Jakub Kicinski --- diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c index 78ed508ebc1b8..df7dbcfa3b713 100644 --- a/net/mptcp/sched.c +++ b/net/mptcp/sched.c @@ -60,7 +60,6 @@ void mptcp_get_available_schedulers(char *buf, size_t maxlen) size_t offs = 0; rcu_read_lock(); - spin_lock(&mptcp_sched_list_lock); list_for_each_entry_rcu(sched, &mptcp_sched_list, list) { offs += snprintf(buf + offs, maxlen - offs, "%s%s", @@ -69,7 +68,6 @@ void mptcp_get_available_schedulers(char *buf, size_t maxlen) if (WARN_ON_ONCE(offs >= maxlen)) break; } - spin_unlock(&mptcp_sched_list_lock); rcu_read_unlock(); }