diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2016-11-15 17:02:38 -0800 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2016-11-15 17:02:38 -0800 |
commit | 324e88de4aba3b6d4e0453fb2adb094e4a53754c (patch) | |
tree | f961e8c1eb2bcdefec062e0b86d4b5f307caee1e /include/net/sock.h | |
parent | 93e3336909d88c3afca7ccdc8b009c435f37a70a (diff) | |
parent | 4dab3e4df9944782cb3c229bd37f5ea8b5f52bac (diff) |
Merge tag 'v4.4.32' into android-4.4.y
This is the 4.4.32 stable release
Change-Id: I5028402eadfcf055ac44a5e67abc6da75b2068b3
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 2d663ee8494d..8f77df63a8f4 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1426,6 +1426,16 @@ static inline void sk_mem_uncharge(struct sock *sk, int size) if (!sk_has_account(sk)) return; sk->sk_forward_alloc += size; + + /* Avoid a possible overflow. + * TCP send queues can make this happen, if sk_mem_reclaim() + * is not called and more than 2 GBytes are released at once. + * + * If we reach 2 MBytes, reclaim 1 MBytes right now, there is + * no need to hold that much forward allocation anyway. + */ + if (unlikely(sk->sk_forward_alloc >= 1 << 21)) + __sk_mem_reclaim(sk, 1 << 20); } static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) |