aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sock.h8
-rw-r--r--net/ipv4/tcp_timer.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 786fae858e77..902324488d0f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -759,6 +759,14 @@ static inline void sk_mem_reclaim(struct sock *sk)
759 __sk_mem_reclaim(sk); 759 __sk_mem_reclaim(sk);
760} 760}
761 761
762static 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
762static inline void sk_mem_charge(struct sock *sk, int size) 770static inline void sk_mem_charge(struct sock *sk, int size)
763{ 771{
764 if (!sk_has_account(sk)) 772 if (!sk_has_account(sk))
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 17931be6d584..803d758a2b12 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -186,7 +186,7 @@ static void tcp_delack_timer(unsigned long data)
186 goto out_unlock; 186 goto out_unlock;
187 } 187 }
188 188
189 sk_mem_reclaim(sk); 189 sk_mem_reclaim_partial(sk);
190 190
191 if (sk->sk_state == TCP_CLOSE || !(icsk->icsk_ack.pending & ICSK_ACK_TIMER)) 191 if (sk->sk_state == TCP_CLOSE || !(icsk->icsk_ack.pending & ICSK_ACK_TIMER))
192 goto out; 192 goto out;