diff options
Diffstat (limited to 'net/ipv4/tcp_input.c')
| -rw-r--r-- | net/ipv4/tcp_input.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 3357f69e353d..6d8ab1c4efc3 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -259,8 +259,11 @@ static void tcp_fixup_sndbuf(struct sock *sk) | |||
| 259 | int sndmem = tcp_sk(sk)->rx_opt.mss_clamp + MAX_TCP_HEADER + 16 + | 259 | int sndmem = tcp_sk(sk)->rx_opt.mss_clamp + MAX_TCP_HEADER + 16 + |
| 260 | sizeof(struct sk_buff); | 260 | sizeof(struct sk_buff); |
| 261 | 261 | ||
| 262 | if (sk->sk_sndbuf < 3 * sndmem) | 262 | if (sk->sk_sndbuf < 3 * sndmem) { |
| 263 | sk->sk_sndbuf = min(3 * sndmem, sysctl_tcp_wmem[2]); | 263 | sk->sk_sndbuf = 3 * sndmem; |
| 264 | if (sk->sk_sndbuf > sysctl_tcp_wmem[2]) | ||
| 265 | sk->sk_sndbuf = sysctl_tcp_wmem[2]; | ||
| 266 | } | ||
| 264 | } | 267 | } |
| 265 | 268 | ||
| 266 | /* 2. Tuning advertised window (window_clamp, rcv_ssthresh) | 269 | /* 2. Tuning advertised window (window_clamp, rcv_ssthresh) |
| @@ -396,7 +399,7 @@ static void tcp_clamp_window(struct sock *sk) | |||
| 396 | if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] && | 399 | if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] && |
| 397 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && | 400 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && |
| 398 | !tcp_memory_pressure && | 401 | !tcp_memory_pressure && |
| 399 | atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) { | 402 | atomic_long_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) { |
| 400 | sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc), | 403 | sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc), |
| 401 | sysctl_tcp_rmem[2]); | 404 | sysctl_tcp_rmem[2]); |
| 402 | } | 405 | } |
| @@ -4861,7 +4864,7 @@ static int tcp_should_expand_sndbuf(struct sock *sk) | |||
| 4861 | return 0; | 4864 | return 0; |
| 4862 | 4865 | ||
| 4863 | /* If we are under soft global TCP memory pressure, do not expand. */ | 4866 | /* If we are under soft global TCP memory pressure, do not expand. */ |
| 4864 | if (atomic_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0]) | 4867 | if (atomic_long_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0]) |
| 4865 | return 0; | 4868 | return 0; |
| 4866 | 4869 | ||
| 4867 | /* If we filled the congestion window, do not expand. */ | 4870 | /* If we filled the congestion window, do not expand. */ |
