diff options
author | Wei Wang | 2021-09-29 10:25:12 -0700 |
---|---|---|
committer | David S. Miller | 2021-09-30 13:36:46 +0100 |
commit | ca057051cf25a8c198af7b73daf922ef65a3c016 (patch) | |
tree | 3454d2e3c12770adc387078b79f9f0f8434b04b6 /include | |
parent | 2bb2f5fb21b0486ff69b7b4a1fe03a760527d133 (diff) |
tcp: adjust sndbuf according to sk_reserved_mem
If user sets SO_RESERVE_MEM socket option, in order to fully utilize the
reserved memory in memory pressure state on the tx path, we modify the
logic in sk_stream_moderate_sndbuf() to set sk_sndbuf according to
available reserved memory, instead of MIN_SOCK_SNDBUF, and adjust it
when new data is acked.
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/sock.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 447fddb384a4..c3af696258fe 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2378,6 +2378,7 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk) return; val = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); + val = max_t(u32, val, sk_unused_reserved_mem(sk)); WRITE_ONCE(sk->sk_sndbuf, max_t(u32, val, SOCK_MIN_SNDBUF)); } |