Commit e8259a94 authored by David S. Miller's avatar David S. Miller

[TCP]: More sysctl tweakings for rcvbuf stuff.

1) Add sysctl to control rcvbuf moderation, off for now.
2) Set default winscale to zero.
parent f7eb18a7
...@@ -337,6 +337,7 @@ enum ...@@ -337,6 +337,7 @@ enum
NET_TCP_BIC_FAST_CONVERGENCE=103, NET_TCP_BIC_FAST_CONVERGENCE=103,
NET_TCP_BIC_LOW_WINDOW=104, NET_TCP_BIC_LOW_WINDOW=104,
NET_TCP_DEFAULT_WIN_SCALE=105, NET_TCP_DEFAULT_WIN_SCALE=105,
NET_TCP_MODERATE_RCVBUF=106,
}; };
enum { enum {
......
...@@ -611,6 +611,7 @@ extern int sysctl_tcp_bic; ...@@ -611,6 +611,7 @@ extern int sysctl_tcp_bic;
extern int sysctl_tcp_bic_fast_convergence; extern int sysctl_tcp_bic_fast_convergence;
extern int sysctl_tcp_bic_low_window; extern int sysctl_tcp_bic_low_window;
extern int sysctl_tcp_default_win_scale; extern int sysctl_tcp_default_win_scale;
extern int sysctl_tcp_moderate_rcvbuf;
extern atomic_t tcp_memory_allocated; extern atomic_t tcp_memory_allocated;
extern atomic_t tcp_sockets_allocated; extern atomic_t tcp_sockets_allocated;
......
...@@ -673,6 +673,14 @@ ctl_table ipv4_table[] = { ...@@ -673,6 +673,14 @@ ctl_table ipv4_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .proc_handler = &proc_dointvec,
}, },
{
.ctl_name = NET_TCP_MODERATE_RCVBUF,
.procname = "tcp_moderate_rcvbuf",
.data = &sysctl_tcp_moderate_rcvbuf,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
{ .ctl_name = 0 } { .ctl_name = 0 }
}; };
......
...@@ -276,7 +276,7 @@ kmem_cache_t *tcp_timewait_cachep; ...@@ -276,7 +276,7 @@ kmem_cache_t *tcp_timewait_cachep;
atomic_t tcp_orphan_count = ATOMIC_INIT(0); atomic_t tcp_orphan_count = ATOMIC_INIT(0);
int sysctl_tcp_default_win_scale = 7; int sysctl_tcp_default_win_scale;
int sysctl_tcp_mem[3]; int sysctl_tcp_mem[3];
int sysctl_tcp_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 }; int sysctl_tcp_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 };
......
...@@ -90,6 +90,8 @@ int sysctl_tcp_nometrics_save; ...@@ -90,6 +90,8 @@ int sysctl_tcp_nometrics_save;
int sysctl_tcp_westwood; int sysctl_tcp_westwood;
int sysctl_tcp_vegas_cong_avoid; int sysctl_tcp_vegas_cong_avoid;
int sysctl_tcp_moderate_rcvbuf;
/* Default values of the Vegas variables, in fixed-point representation /* Default values of the Vegas variables, in fixed-point representation
* with V_PARAM_SHIFT bits to the right of the binary point. * with V_PARAM_SHIFT bits to the right of the binary point.
*/ */
...@@ -460,19 +462,21 @@ void tcp_rcv_space_adjust(struct sock *sk) ...@@ -460,19 +462,21 @@ void tcp_rcv_space_adjust(struct sock *sk)
tp->rcvq_space.space = space; tp->rcvq_space.space = space;
/* Receive space grows, normalize in order to if (sysctl_tcp_moderate_rcvbuf) {
* take into account packet headers and sk_buff /* Receive space grows, normalize in order to
* structure overhead. * take into account packet headers and sk_buff
*/ * structure overhead.
space /= tp->advmss; */
if (!space) space /= tp->advmss;
space = 1; if (!space)
rcvmem = (tp->advmss + MAX_TCP_HEADER + space = 1;
16 + sizeof(struct sk_buff)); rcvmem = (tp->advmss + MAX_TCP_HEADER +
space *= rcvmem; 16 + sizeof(struct sk_buff));
space = min(space, sysctl_tcp_rmem[2]); space *= rcvmem;
if (space > sk->sk_rcvbuf) space = min(space, sysctl_tcp_rmem[2]);
sk->sk_rcvbuf = space; if (space > sk->sk_rcvbuf)
sk->sk_rcvbuf = space;
}
} }
new_measure: new_measure:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment