Commit 9993e7d313e80bdc005d09c7def91903e0068f07

Authored by David S. Miller
1 parent e186932b3d

[TCP]: Do not purge sk_forward_alloc entirely in tcp_delack_timer().

Otherwise we beat heavily on the global tcp_memory atomics
when all of the sockets in the system are slowly sending
perioding packet clumps.

Noticed and suggested by Eric Dumazet.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 9 additions and 1 deletions Side-by-side Diff

... ... @@ -759,6 +759,14 @@
759 759 __sk_mem_reclaim(sk);
760 760 }
761 761  
  762 +static inline void sk_mem_reclaim_partial(struct sock *sk)
  763 +{
  764 + if (!sk_has_account(sk))
  765 + return;
  766 + if (sk->sk_forward_alloc > SK_MEM_QUANTUM)
  767 + __sk_mem_reclaim(sk);
  768 +}
  769 +
762 770 static inline void sk_mem_charge(struct sock *sk, int size)
763 771 {
764 772 if (!sk_has_account(sk))
net/ipv4/tcp_timer.c
... ... @@ -186,7 +186,7 @@
186 186 goto out_unlock;
187 187 }
188 188  
189   - sk_mem_reclaim(sk);
  189 + sk_mem_reclaim_partial(sk);
190 190  
191 191 if (sk->sk_state == TCP_CLOSE || !(icsk->icsk_ack.pending & ICSK_ACK_TIMER))
192 192 goto out;