Skip to contentSkip to conversation

mptcp: adjust tcp rcvspace after moving skbs from ssk to sk queue

PATCH Superseded Florian Westphal 2 participants 3 messages May 22, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mptcp: adjust tcp rcvspace after moving skbs from ssk to sk queue

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.

---
 net/mptcp/protocol.c | 4 ++++
 1 file changed, 4 insertions(+)
net/mptcp/protocol.c +4 -0
index ba9d3d5c625f..dbb86cbb9e77 100644
@@ -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;
Signature · 1 line
2.26.2
maintainer
#1 lore raw

Hi,

Quoted 21 lines · 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.

---
 net/mptcp/protocol.c | 4 ++++
 1 file changed, 4 insertions(+)
net/mptcp/protocol.c +0 -0
index ba9d3d5c625f..dbb86cbb9e77 100644

net/mptcp/protocol.c static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, · line 255

Quoted 8 lines
net/mptcp/protocol.c +3 -0
@@ -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

#2 lore raw
Quoted 5 lines · Paolo Abeni

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.