diff mbox series

[RFC] tcp: consistently disable header prediction for mptcp

Message ID 982d258452274d2b165b07883307c01a44dbf7f7.1623434219.git.pabeni@redhat.com (mailing list archive)
State Accepted, archived
Commit c33c021a93946bf31efadebdb7c05a850aac8dc3
Delegated to: Matthieu Baerts
Headers show
Series [RFC] tcp: consistently disable header prediction for mptcp | expand

Commit Message

Paolo Abeni June 11, 2021, 5:57 p.m. UTC
The MPTCP receive path is hooked only into the TCP slow-path.
The DSS presence allows plain MPTCP traffic to hit that
consistently.

Since commit e1ff9e82e2ea ("net: mptcp: improve fallback to TCP"),
when and MPTCP socket falls back to TCP, we can the receive
fast path, and delay or stop triggering the event notification.

Address the issue explicitly disabling the header prediction
for MPTCP sockets.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/200
Fixes: e1ff9e82e2ea ("net: mptcp: improve fallback to TCP")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
I could not find a reliable way to disable header prediction
touching the MPTCP code only: the TCP stack can flip header
prediction on in a bunch of points and I could not find existing
MPTCP hooks after such check to revert the change.

So I opted for this TCP change, unless we are able to really
drop TCP fast path ?!? (see commit
31770e34e43d6c8dee129bfee77e56c34e61f0e5)

@Florian: WDYT?
---
 include/net/tcp.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Mat Martineau June 15, 2021, 10:45 p.m. UTC | #1
On Fri, 11 Jun 2021, Paolo Abeni wrote:

> The MPTCP receive path is hooked only into the TCP slow-path.
> The DSS presence allows plain MPTCP traffic to hit that
> consistently.
>
> Since commit e1ff9e82e2ea ("net: mptcp: improve fallback to TCP"),
> when and MPTCP socket falls back to TCP, we can the receive
> fast path, and delay or stop triggering the event notification.
>
> Address the issue explicitly disabling the header prediction
> for MPTCP sockets.
>
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/200
> Fixes: e1ff9e82e2ea ("net: mptcp: improve fallback to TCP")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> I could not find a reliable way to disable header prediction
> touching the MPTCP code only: the TCP stack can flip header
> prediction on in a bunch of points and I could not find existing
> MPTCP hooks after such check to revert the change.
>
> So I opted for this TCP change, unless we are able to really
> drop TCP fast path ?!? (see commit
> 31770e34e43d6c8dee129bfee77e56c34e61f0e5)
>
> @Florian: WDYT?

I'm also interested in Florian's thoughts.

We need to fix MPTCP fallback whether regular TCP fast path is still 
present or not, so I'm in favor of this patch. Looking at Florian's 
comments on those previous patches (31770e34e43 and the patch it reverts), 
I wonder if anything in the last four years has changed tcp_ack() calls 
enough to affect performance.


Mat

> ---
> include/net/tcp.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index e668f1bf780d..17df9b047ee4 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -686,6 +686,10 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
>
> static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
> {
> +	/* mptcp hooks are only on the slow path */
> +	if (sk_is_mptcp((struct sock *)tp))
> +		return;
> +
> 	tp->pred_flags = htonl((tp->tcp_header_len << 26) |
> 			       ntohl(TCP_FLAG_ACK) |
> 			       snd_wnd);
> -- 
> 2.26.3
>
>
>

--
Mat Martineau
Intel
Matthieu Baerts June 24, 2021, 4:02 p.m. UTC | #2
Hi Paolo,

On 11/06/2021 19:57, Paolo Abeni wrote:
> The MPTCP receive path is hooked only into the TCP slow-path.
> The DSS presence allows plain MPTCP traffic to hit that
> consistently.
> 
> Since commit e1ff9e82e2ea ("net: mptcp: improve fallback to TCP"),
> when and MPTCP socket falls back to TCP, we can the receive
> fast path, and delay or stop triggering the event notification.
> 
> Address the issue explicitly disabling the header prediction
> for MPTCP sockets.
> 
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/200
> Fixes: e1ff9e82e2ea ("net: mptcp: improve fallback to TCP")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Thank you for the patch!

I just applied it in our tree so we have some tests and we can easily
work on top of it while it is going to be discussed upstream when you
are going to send it.

New patches:

- c33c021a9394: tcp: consistently disable header prediction for mptcp

- Results: 07b006118fa3..1f935a2c8db1

Builds and tests are now in progress:



https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20210624T160212

https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export/20210624T160212

Cheers,
Matt
diff mbox series

Patch

diff --git a/include/net/tcp.h b/include/net/tcp.h
index e668f1bf780d..17df9b047ee4 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -686,6 +686,10 @@  static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
 
 static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
 {
+	/* mptcp hooks are only on the slow path */
+	if (sk_is_mptcp((struct sock *)tp))
+		return;
+
 	tp->pred_flags = htonl((tp->tcp_header_len << 26) |
 			       ntohl(TCP_FLAG_ACK) |
 			       snd_wnd);