]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mptcp: pm: lockless list traversal to dump endp
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Fri, 15 Nov 2024 16:52:34 +0000 (17:52 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 19 Nov 2024 02:50:13 +0000 (18:50 -0800)
commit3fbb27b7f87e60324cec7d2d10a40884182c99d4
tree722f9df80b4cc5e248ed6e03a8ae36b29fe42941
parentcc84d89ad8d411d52ec4d000c3ed5cce52683fbd
mptcp: pm: lockless list traversal to dump endp

To return an endpoint to the userspace via Netlink, and to dump all of
them, the endpoint list was iterated while holding the pernet->lock, but
only to read the content of the list.

In these cases, the spin locks can be replaced by RCU read ones, and use
the _rcu variants to iterate over the entries list in a lockless way.

Note that the __lookup_addr_by_id() helper has been modified to use the
_rcu variants of list_for_each_entry(), but with an extra conditions, so
it can be called either while the RCU read lock is held, or when the
associated pernet->lock is held.

Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20241115-net-next-mptcp-pm-lockless-dump-v1-1-f4a1bcb4ca2c@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/pm_netlink.c