internal secret of tcp_rmem

3 篇文章 0 订阅
2 篇文章 0 订阅

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".



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值