mptcp: use _fast lock version in __mptcp_move_skbs
Subsystems (2)
Florian Westphal
PATCH 1/1 mptcp: use _fast lock version in __mptcp_move_skbs
The function is short and won't sleep, so this can use the _fast version.
--- net/mptcp/protocol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/mptcp/protocol.c +3 -2
@@ -1472,13 +1472,14 @@ static bool __mptcp_move_skbs(struct mptcp_sock *msk)__mptcp_flush_join_list (msk);do {struct sock *ssk =mptcp_subflow_recv_lookup (msk); +bool slowpath;if (!ssk)break ; -lock_sock (ssk); + slowpath =lock_sock_fast (ssk); done =__mptcp_move_skbs_from_subflow (msk, ssk, &moved); -release_sock (ssk); +unlock_sock_fast (ssk, slowpath); }while (!done);if (mptcp_ofo_queue (msk) || moved >0 ) {
Signature · 1 line
2.26.2
Paolo Abeni
Quoted 18 lines · Florian Westphal
The function is short and won't sleep, so this can use the
_fastversion.Signed-off-by Florian Westphal <fw(a)strlen.de>--- net/mptcp/protocol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/mptcp/protocol.c +1
-0@@ -1472,13 +1472,14 @@ static bool __mptcp_move_skbs(struct mptcp_sock *msk)__mptcp_flush_join_list (msk); do { struct sock *ssk = mptcp_subflow_recv_lookup(msk); + bool slowpath; if (!ssk)
net/mptcp/protocol.c static bool __mptcp_move_skbs(struct mptcp_sock *msk) · line 1485
Quoted 10 lines
net/mptcp/protocol.c +2
-2break ; -lock_sock (ssk); + slowpath =lock_sock_fast (ssk); done =__mptcp_move_skbs_from_subflow (msk, ssk, &moved); -release_sock (ssk); +unlock_sock_fast (ssk, slowpath); }while (!done);if (mptcp_ofo_queue (msk) || moved >0 ) {
Good catch! the patch LGTM, thanks!
Do you think it could useful do the same also in mptcp_sendmsg() and mptcp_worker()? (since mptcp_sendmsg_frag() does not sleep, should be possible...)
Cheers,
Paolo
Florian Westphal
Quoted 28 lines · Paolo Abeni
Quoted 27 lines · Florian Westphal
The function is short and won't sleep, so this can use the
_fastversion.Signed-off-by Florian Westphal <fw(a)strlen.de>--- net/mptcp/protocol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/mptcp/protocol.c +3
-2@@ -1472,13 +1472,14 @@ static bool __mptcp_move_skbs(struct mptcp_sock *msk)__mptcp_flush_join_list (msk);do {struct sock *ssk =mptcp_subflow_recv_lookup (msk); +bool slowpath;if (!ssk)break ; -lock_sock (ssk); + slowpath =lock_sock_fast (ssk); done =__mptcp_move_skbs_from_subflow (msk, ssk, &moved); -release_sock (ssk); +unlock_sock_fast (ssk, slowpath); }while (!done);
Quoted 7 lines
net/mptcp/protocol.c static bool __mptcp_move_skbs(struct mptcp_sock *msk) · line 1485
Quoted 1 line
net/mptcp/protocol.c +0
-0if (mptcp_ofo_queue (msk) || moved >0 ) {Good catch! the patch LGTM, thanks!
Do you think it could useful do the same also in
mptcp_sendmsg()andmptcp_worker()? (sincemptcp_sendmsg_frag()does not sleep, should be possible...)
sendmsg path might sleep (it copies data from userspace).
mptcp_worker might work, but I think we would need to make sure mptcp_ext_cache_refill() uses atomic allocations for this to work.
Not sure this is a good idea. For work queue case I think its better to try to make it a true slowpath that isn't invoked frequently.
Paolo Abeni
Quoted 33 lines · Florian Westphal
Quoted 32 lines · Paolo Abeni
Quoted 18 lines · Florian Westphal
The function is short and won't sleep, so this can use the
_fastversion.Signed-off-by Florian Westphal <fw(a)strlen.de>--- net/mptcp/protocol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/mptcp/protocol.c +1
-0@@ -1472,13 +1472,14 @@ static bool __mptcp_move_skbs(struct mptcp_sock *msk)__mptcp_flush_join_list (msk); do { struct sock *ssk = mptcp_subflow_recv_lookup(msk); + bool slowpath; if (!ssk)net/mptcp/protocol.c static bool __mptcp_move_skbs(struct mptcp_sock *msk) · line 1485
Quoted 10 lines
net/mptcp/protocol.c +2
-2break ; -lock_sock (ssk); + slowpath =lock_sock_fast (ssk); done =__mptcp_move_skbs_from_subflow (msk, ssk, &moved); -release_sock (ssk); +unlock_sock_fast (ssk, slowpath); }while (!done);if (mptcp_ofo_queue (msk) || moved >0 ) {Good catch! the patch LGTM, thanks!
Quoted 5 lines
Quoted 3 lines
Do you think it could useful do the same also in
mptcp_sendmsg()andmptcp_worker()? (sincemptcp_sendmsg_frag()does not sleep, should be possible...)sendmsg path might sleep (it copies data from userspace).
Whoops I missed that.
Quoted 5 lines
mptcp_workermight work, but I think we would need to make suremptcp_ext_cache_refill()uses atomic allocations for this to work.Not sure this is a good idea. For work queue case I think its better to try to make it a true slowpath that isn't invoked frequently.
Agreed, we really don't want to over-optimize the worker
I'm fine with this, thanks!
Paolo
Matthieu Baerts
Hi Florian, Paolo,
Quoted 6 lines · Paolo Abeni
Quoted 5 lines · Florian Westphal
Quoted 4 lines · Paolo Abeni
Quoted 3 lines · Florian Westphal
The function is short and won't sleep, so this can use the
_fastversion.Signed-off-by Florian Westphal <fw(a)strlen.de>
(...)
Quoted 13 lines
Quoted 7 lines
Quoted 5 lines
Good catch! the patch LGTM, thanks!
Do you think it could useful do the same also in
mptcp_sendmsg()andmptcp_worker()? (sincemptcp_sendmsg_frag()does not sleep, should be possible...)sendmsg path might sleep (it copies data from userspace).
Whoops I missed that.
Quoted 3 lines
mptcp_workermight work, but I think we would need to make suremptcp_ext_cache_refill()uses atomic allocations for this to work.
Quoted 6 lines
Quoted 2 lines
Not sure this is a good idea. For work queue case I think its better to try to make it a true slowpath that isn't invoked frequently.
Agreed, we really don't want to over-optimize the worker
I'm fine with this, thanks!
Thank you for the patch and the review!
Just added at the end of the series!
Tests + export are in progress.
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net