The following code are copied from Linux 2.6.29
Secret 1:
In function tcp_init(void),
sysctl_tcp_rmem[0] = SK_MEM_QUANTUM;
sysctl_tcp_rmem[1] = 87380;
sysctl_tcp_rmem[2] = max(87380, max_share);
So the initial tcp win is set as a fixed value - 87380 at initialization stage of TCP.
Secret 2:
In function tcp_v4_init_sock,sk->sk_sndbuf = sysctl_tcp_wmem[1];
sk->sk_rcvbuf = sysctl_tcp_rmem[1];
So the second value of "tcp_rmem" in fact affecting sock buffer size which contains not only tcp win, but also overhead. But that's just the begining.In file tcp_input.c, sk->sk_rcvbuf would be affected by sysctl_tcp_mem[2].Secret 3:
In function tcp_select_initial_window,
TCP initial win size would be affected by sysctl_tcp_rmem[2], but not by sysctl_tcp_rmem[1].
I was shocked by this fact! As from doc I was always convinced that initial TCP win size is set by the second value i.e sysctl_tcp_rmem[1]. But in fact the calculation process is quite complicated and it is not a direct map from "tcp_rmem".