* [PATCH net-next v2] mptcp: remove unneeded lock when listing scheds
@ 2024-11-04 12:43 Matthieu Baerts (NGI0)
2024-11-06 2:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-11-04 12:43 UTC (permalink / raw)
To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: netdev, linux-kernel, Matthieu Baerts (NGI0)
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 <pabeni@redhat.com>
Reviewed-by: Geliang Tang <geliang@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
v2:
- Rebased on top of net-next instead of net, same code.
- Removed the 'Fixes' tag, add Simon's RvB tag.
- Link to v1: https://lore.kernel.org/20241021-net-mptcp-sched-lock-v1-2-637759cf061c@kernel.org
---
net/mptcp/sched.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c
index 78ed508ebc1b8dd9f0e020cca1bdd86f24f0afeb..df7dbcfa3b71370cc4d7e4e4f16cc1e41a50dddf 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();
}
---
base-commit: ecf99864ea6b1843773589a935bb026951bf12dd
change-id: 20241104-net-next-mptcp-sched-unneeded-lock-006eb3fc96b7
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@kernel.org>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v2] mptcp: remove unneeded lock when listing scheds
2024-11-04 12:43 [PATCH net-next v2] mptcp: remove unneeded lock when listing scheds Matthieu Baerts (NGI0)
@ 2024-11-06 2:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-06 2:20 UTC (permalink / raw)
To: Matthieu Baerts
Cc: mptcp, martineau, geliang, davem, edumazet, kuba, pabeni, horms,
netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 04 Nov 2024 13:43:47 +0100 you wrote:
> 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").
>
> [...]
Here is the summary with links:
- [net-next,v2] mptcp: remove unneeded lock when listing scheds
https://git.kernel.org/netdev/net-next/c/f2c71c49da8f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-06 2:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 12:43 [PATCH net-next v2] mptcp: remove unneeded lock when listing scheds Matthieu Baerts (NGI0)
2024-11-06 2:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).