From: Geliang Tang <geliang@kernel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, mptcp@lists.linux.dev
Cc: Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH mptcp-net 1/2] mptcp: remove unneeded lock when listing scheds
Date: Fri, 18 Oct 2024 09:07:52 +0800 [thread overview]
Message-ID: <a21162662aca34dc4d3891f5d372b13822848df9.camel@kernel.org> (raw)
In-Reply-To: <20241017-mptcp-sched-avail-lock-v1-1-028ef592c6f4@kernel.org>
Hi Matt,
Thanks for this fix.
On Thu, 2024-10-17 at 12:16 +0200, Matthieu Baerts (NGI0) 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.
>
> Fixes: 73c900aa3660 ("mptcp: add net.mptcp.available_schedulers")
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Good catch!
Reviewed-by: Geliang Tang <geliang@kernel.org>
-Geliang
> ---
> net/mptcp/sched.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c
> index
> 5257bc6c8cd6e8ca674c9beccaf7b27c989da76a..6da60e35932ffd8a92ad7a8b128
> e5eaf09219b82 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();
> }
>
>
next prev parent reply other threads:[~2024-10-18 1:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 10:16 [PATCH mptcp-net 0/2] mptcp: remove unneeded lock when listing scheds Matthieu Baerts (NGI0)
2024-10-17 10:16 ` [PATCH mptcp-net 1/2] " Matthieu Baerts (NGI0)
2024-10-18 1:07 ` Geliang Tang [this message]
2024-10-17 10:16 ` [PATCH mptcp-net 2/2] selftests: mptcp: list sysctl data Matthieu Baerts (NGI0)
2024-10-17 11:22 ` [PATCH mptcp-net 0/2] mptcp: remove unneeded lock when listing scheds MPTCP CI
2024-10-19 11:53 ` Matthieu Baerts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a21162662aca34dc4d3891f5d372b13822848df9.camel@kernel.org \
--to=geliang@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox