Patch "tcp: remove 64 KByte limit for initial tp->rcv_wnd value" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    tcp: remove 64 KByte limit for initial tp->rcv_wnd value

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tcp-remove-64-kbyte-limit-for-initial-tp-rcv_wnd-val.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d95db3294f123d366133d54b7f3c12a5ee0ac717
Author: Jason Xing <kernelxing@xxxxxxxxxxx>
Date:   Tue May 21 21:42:20 2024 +0800

    tcp: remove 64 KByte limit for initial tp->rcv_wnd value
    
    [ Upstream commit 378979e94e953c2070acb4f0e0c98d29260bd09d ]
    
    Recently, we had some servers upgraded to the latest kernel and noticed
    the indicator from the user side showed worse results than before. It is
    caused by the limitation of tp->rcv_wnd.
    
    In 2018 commit a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin
    to around 64KB") limited the initial value of tp->rcv_wnd to 65535, most
    CDN teams would not benefit from this change because they cannot have a
    large window to receive a big packet, which will be slowed down especially
    in long RTT. Small rcv_wnd means slow transfer speed, to some extent. It's
    the side effect for the latency/time-sensitive users.
    
    To avoid future confusion, current change doesn't affect the initial
    receive window on the wire in a SYN or SYN+ACK packet which are set within
    65535 bytes according to RFC 7323 also due to the limit in
    __tcp_transmit_skb():
    
        th->window      = htons(min(tp->rcv_wnd, 65535U));
    
    In one word, __tcp_transmit_skb() already ensures that constraint is
    respected, no matter how large tp->rcv_wnd is. The change doesn't violate
    RFC.
    
    Let me provide one example if with or without the patch:
    Before:
    client   --- SYN: rwindow=65535 ---> server
    client   <--- SYN+ACK: rwindow=65535 ----  server
    client   --- ACK: rwindow=65536 ---> server
    Note: for the last ACK, the calculation is 512 << 7.
    
    After:
    client   --- SYN: rwindow=65535 ---> server
    client   <--- SYN+ACK: rwindow=65535 ----  server
    client   --- ACK: rwindow=175232 ---> server
    Note: I use the following command to make it work:
    ip route change default via [ip] dev eth0 metric 100 initrwnd 120
    For the last ACK, the calculation is 1369 << 7.
    
    When we apply such a patch, having a large rcv_wnd if the user tweak this
    knob can help transfer data more rapidly and save some rtts.
    
    Fixes: a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin to around 64KB")
    Signed-off-by: Jason Xing <kernelxing@xxxxxxxxxxx>
    Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Acked-by: Neal Cardwell <ncardwell@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240521134220.12510-1-kerneljasonxing@xxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 68f1633c477ae..efc57fa04f860 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -229,7 +229,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss,
 	if (sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows)
 		(*rcv_wnd) = min(space, MAX_TCP_WINDOW);
 	else
-		(*rcv_wnd) = min_t(u32, space, U16_MAX);
+		(*rcv_wnd) = space;
 
 	if (init_rcv_wnd)
 		*rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux