Skip to content

Commit 9993e7d

Browse files
committed
[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 <[email protected]>
1 parent e186932 commit 9993e7d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

include/net/sock.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,14 @@ static inline void sk_mem_reclaim(struct sock *sk)
759759
__sk_mem_reclaim(sk);
760760
}
761761

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+
762770
static inline void sk_mem_charge(struct sock *sk, int size)
763771
{
764772
if (!sk_has_account(sk))

net/ipv4/tcp_timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void tcp_delack_timer(unsigned long data)
186186
goto out_unlock;
187187
}
188188

189-
sk_mem_reclaim(sk);
189+
sk_mem_reclaim_partial(sk);
190190

191191
if (sk->sk_state == TCP_CLOSE || !(icsk->icsk_ack.pending & ICSK_ACK_TIMER))
192192
goto out;

0 commit comments

Comments
 (0)