Skip to contentSkip to conversation

tcp: remove mss check in tcp_select_initial_window()

PATCH Applied Wei Wang 3 participants 3 messages Apr 26, 2018 – Apr 27, 2018

Subsystems (3)
lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH 1/1 tcp: remove mss check in tcp_select_initial_window()

From: Wei Wang <[email protected]>

In tcp_select_initial_window(), we only set rcv_wnd to tcp_default_init_rwnd() if current mss > (1 << wscale). Otherwise, rcv_wnd is kept at the full receive space of the socket which is a value way larger than tcp_default_init_rwnd().
With larger initial rcv_wnd value, receive buffer autotuning logic takes longer to kick in and increase the receive buffer.

In a TCP throughput test where receiver has rmem[2] set to 125MB (wscale is 11), we see the connection gets recvbuf limited at the beginning of the connection and gets less throughput overall.

---
 net/ipv4/tcp_output.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
net/ipv4/tcp_output.c +3 -5
index 95feffb6d53f..d07c0dcc99aa 100644
@@ -229,11 +229,9 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss,
 		}
 	}
 
-	if (mss > (1 << *rcv_wscale)) {
-		if (!init_rcv_wnd) /* Use default unless specified otherwise */
-			init_rcv_wnd = tcp_default_init_rwnd(mss);
-		*rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
-	}
+	if (!init_rcv_wnd) /* Use default unless specified otherwise */
+		init_rcv_wnd = tcp_default_init_rwnd(mss);
+	*rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
 
 	/* Set the clamp no higher than max representable value */
 	(*window_clamp) = min_t(__u32, U16_MAX << (*rcv_wscale), *window_clamp);
Signature · 1 line
2.17.0.484.g0c8726318c-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Wei Wang

From: Wei Wang <[email protected]>

In tcp_select_initial_window(), we only set rcv_wnd to tcp_default_init_rwnd() if current mss > (1 << wscale). Otherwise, rcv_wnd is kept at the full receive space of the socket which is a value way larger than tcp_default_init_rwnd().
With larger initial rcv_wnd value, receive buffer autotuning logic takes longer to kick in and increase the receive buffer.

In a TCP throughput test where receiver has rmem[2] set to 125MB (wscale is 11), we see the connection gets recvbuf limited at the beginning of the connection and gets less throughput overall.

Quoted 5 lines

---

Thanks, Wei!

neal

maintainer Applied
#2 lore raw
In reply to Wei Wang

From: Wei Wang <[email protected]>
Date: Thu, 26 Apr 2018 09:58:10 -0700

Quoted 9 lines

From: Wei Wang <[email protected]>

In tcp_select_initial_window(), we only set rcv_wnd to tcp_default_init_rwnd() if current mss > (1 << wscale). Otherwise, rcv_wnd is kept at the full receive space of the socket which is a value way larger than tcp_default_init_rwnd().
With larger initial rcv_wnd value, receive buffer autotuning logic takes longer to kick in and increase the receive buffer.

Quoted 8 lines

In a TCP throughput test where receiver has rmem[2] set to 125MB (wscale is 11), we see the connection gets recvbuf limited at the beginning of the connection and gets less throughput overall.

Very nice commit message.

Applied.