netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: add new socket option SO_RESERVE_MEM
@ 2021-09-27 18:25 Wei Wang
  2021-09-27 18:25 ` [PATCH net-next 1/3] " Wei Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Wei Wang @ 2021-09-27 18:25 UTC (permalink / raw)
  To: David S . Miller, netdev, Jakub Kicinski; +Cc: Shakeel Butt, Eric Dumazet

This patch series introduces a new socket option SO_RESERVE_MEM. 
This socket option provides a mechanism for users to reserve a certain
amount of memory for the socket to use. When this option is set, kernel
charges the user specified amount of memory to memcg, as well as
sk_forward_alloc. This amount of memory is not reclaimable and is
available in sk_forward_alloc for this socket.
With this socket option set, the networking stack spends less cycles
doing forward alloc and reclaim, which should lead to better system
performance, with the cost of an amount of pre-allocated and
unreclaimable memory, even under memory pressure.

The first patch is the implementation of this socket option. The
following 2 patches change the tcp stack to make use of this reserved
memory when under memory pressure. This makes the tcp stack behavior
more flexible when under memory pressure, and provides a way for user to
control the distribution of the memory among its sockets.

Wei Wang (3):
  net: add new socket option SO_RESERVE_MEM
  tcp: adjust sndbuf according to sk_reserved_mem
  tcp: adjust rcv_ssthresh according to sk_reserved_mem

 include/net/sock.h                | 44 +++++++++++++++++---
 include/net/tcp.h                 | 11 +++++
 include/uapi/asm-generic/socket.h |  2 +
 net/core/sock.c                   | 69 +++++++++++++++++++++++++++++++
 net/core/stream.c                 |  2 +-
 net/ipv4/af_inet.c                |  2 +-
 net/ipv4/tcp_input.c              | 26 ++++++++++--
 net/ipv4/tcp_output.c             |  3 +-
 8 files changed, 146 insertions(+), 13 deletions(-)

-- 
2.33.0.685.g46640cef36-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-28  3:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 18:25 [PATCH net-next 0/3] net: add new socket option SO_RESERVE_MEM Wei Wang
2021-09-27 18:25 ` [PATCH net-next 1/3] " Wei Wang
2021-09-27 18:25 ` [PATCH net-next 2/3] tcp: adjust sndbuf according to sk_reserved_mem Wei Wang
2021-09-27 18:25 ` [PATCH net-next 3/3] tcp: adjust rcv_ssthresh " Wei Wang
2021-09-28  0:50 ` [PATCH net-next 0/3] net: add new socket option SO_RESERVE_MEM Jakub Kicinski
2021-09-28  3:33   ` Wei Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).