Skip to content

Commit

Permalink
[TCP]: Do not purge sk_forward_alloc entirely in tcp_delack_timer().
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
davem330 committed Jan 28, 2008
1 parent e186932 commit 9993e7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,14 @@ static inline void sk_mem_reclaim(struct sock *sk)
__sk_mem_reclaim(sk);
}

static inline void sk_mem_reclaim_partial(struct sock *sk)
{
if (!sk_has_account(sk))
return;
if (sk->sk_forward_alloc > SK_MEM_QUANTUM)
__sk_mem_reclaim(sk);
}

static inline void sk_mem_charge(struct sock *sk, int size)
{
if (!sk_has_account(sk))
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static void tcp_delack_timer(unsigned long data)
goto out_unlock;
}

sk_mem_reclaim(sk);
sk_mem_reclaim_partial(sk);

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

0 comments on commit 9993e7d

Please sign in to comment.