netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] mptcp: adjust tcp rcvspace after moving skbs from ssk to sk queue
@ 2020-05-22 12:43 Florian Westphal
  2020-05-22 14:22 ` Paolo Abeni
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2020-05-22 12:43 UTC (permalink / raw)
  To: netdev; +Cc: pabeni, matthieu.baerts, mathew.j.martineau, Florian Westphal

TCP does tcp rcvbuf tuning when copying packets to userspace, e.g. in
tcp_read_sock().  In case of mptcp, that function is only rarely used
(when discarding retransmitted duplicate data).

Instead, skbs are moved from the tcp rx queue to the mptcp socket rx
queue.
Adjust subflow rcvbuf when we do so, its the last spot where we can
adjust the ssk rcvbuf -- later we only have the mptcp-level socket.

This greatly improves performance on mptcp bulk transfers.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/mptcp/protocol.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index ba9d3d5c625f..dbb86cbb9e77 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -248,6 +248,9 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
 
 	*bytes = moved;
 
+	if (moved)
+		tcp_rcv_space_adjust(ssk);
+
 	return done;
 }
 
@@ -1263,6 +1266,7 @@ static int mptcp_init_sock(struct sock *sk)
 		return ret;
 
 	sk_sockets_allocated_inc(sk);
+	sk->sk_rcvbuf = sock_net(sk)->ipv4.sysctl_tcp_rmem[1];
 	sk->sk_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[2];
 
 	return 0;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] mptcp: adjust tcp rcvspace after moving skbs from ssk to sk queue
  2020-05-22 12:43 [PATCH net-next] mptcp: adjust tcp rcvspace after moving skbs from ssk to sk queue Florian Westphal
@ 2020-05-22 14:22 ` Paolo Abeni
  2020-05-22 15:10   ` Florian Westphal
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2020-05-22 14:22 UTC (permalink / raw)
  To: Florian Westphal, netdev; +Cc: matthieu.baerts, mathew.j.martineau

Hi,

On Fri, 2020-05-22 at 14:43 +0200, Florian Westphal wrote:
> TCP does tcp rcvbuf tuning when copying packets to userspace, e.g. in
> tcp_read_sock().  In case of mptcp, that function is only rarely used
> (when discarding retransmitted duplicate data).
> 
> Instead, skbs are moved from the tcp rx queue to the mptcp socket rx
> queue.
> Adjust subflow rcvbuf when we do so, its the last spot where we can
> adjust the ssk rcvbuf -- later we only have the mptcp-level socket.
> 
> This greatly improves performance on mptcp bulk transfers.
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  net/mptcp/protocol.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index ba9d3d5c625f..dbb86cbb9e77 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -248,6 +248,9 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
>  
>  	*bytes = moved;
>  
> +	if (moved)
> +		tcp_rcv_space_adjust(ssk);
> +
>  	return done;
>  }

It looks like this way ssk rcvbuf will grow up to tcp_rmem[2] even if
there is no user-space reader - assuming the link is fast enough.

Don't we need to somehow cap that? e.g. moving mptcp rcvbuf update in
mptcp_revmsg()?

Thanks,

Paolo



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] mptcp: adjust tcp rcvspace after moving skbs from ssk to sk queue
  2020-05-22 14:22 ` Paolo Abeni
@ 2020-05-22 15:10   ` Florian Westphal
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2020-05-22 15:10 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: Florian Westphal, netdev, matthieu.baerts, mathew.j.martineau

Paolo Abeni <pabeni@redhat.com> wrote:
> It looks like this way ssk rcvbuf will grow up to tcp_rmem[2] even if
> there is no user-space reader - assuming the link is fast enough.
> 
> Don't we need to somehow cap that? e.g. moving mptcp rcvbuf update in
> mptcp_revmsg()?

From irc discussion it looks like you already have a patch for that.

I marked this patch as "Changes Requested" and do not plan to resend
it for the time being.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-22 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-22 12:43 [PATCH net-next] mptcp: adjust tcp rcvspace after moving skbs from ssk to sk queue Florian Westphal
2020-05-22 14:22 ` Paolo Abeni
2020-05-22 15:10   ` Florian Westphal

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).