TCP receiving window size higher than net.core.rmem_max

后端 未结 2 1725
一个人的身影
一个人的身影 2020-12-31 10:00

I am running iperf measurements between two servers, connected through 10Gbit link. I am trying to correlate the maximum window size that I observe with the sys

相关标签:
2条回答
  • 2020-12-31 10:21

    net.ipv4.tcp_rmem takes precedence net.core.rmem_max according to https://serverfault.com/questions/734920/difference-between-net-core-rmem-max-and-net-ipv4-tcp-rmem:

    It seems that the tcp-setting will take precendence over the common max setting


    But I agree with what you say, this seems to conflict with what's written in man tcp, and I can reproduce your findings. Maybe the documentation is wrong? Please find out and comment!

    0 讨论(0)
  • 2020-12-31 10:30

    A quick search turned up:

    https://github.com/torvalds/linux/blob/4e5448a31d73d0e944b7adb9049438a09bc332cb/net/ipv4/tcp_output.c

    in void tcp_select_initial_window()

    if (wscale_ok) {
        /* Set window scaling on max possible window
         * See RFC1323 for an explanation of the limit to 14
         */
        space = max_t(u32, sysctl_tcp_rmem[2], sysctl_rmem_max);
        space = min_t(u32, space, *window_clamp);
        while (space > 65535 && (*rcv_wscale) < 14) {
            space >>= 1;
            (*rcv_wscale)++;
        }
    }
    

    max_t takes the higher value of the arguments. So the bigger value takes precedence here.

    One other reference to sysctl_rmem_max is made where it is used to limit the argument to SO_RCVBUF (in net/core/sock.c).

    All other tcp code refers to sysctl_tcp_rmem only.

    So without looking deeper into the code you can conclude that a bigger net.ipv4.tcp_rmem will override net.core.rmem_max in all cases except when setting SO_RCVBUF (whose check can be bypassed using SO_RCVBUFFORCE)

    0 讨论(0)
提交回复
热议问题