All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 net-next 0/2] sctp: fully support memory accounting
@ 2019-04-15  9:15 ` Xin Long
  0 siblings, 0 replies; 8+ messages in thread
From: Xin Long @ 2019-04-15  9:15 UTC (permalink / raw)
  To: network dev, linux-sctp
  Cc: Marcelo Ricardo Leitner, Neil Horman, davem, Matteo Croce,
	Vladis Dronov

sctp memory accounting is added in this patchset by using
these kernel APIs on send side:

  - sk_mem_charge()
  - sk_mem_uncharge()
  - sk_wmem_schedule()
  - sk_under_memory_pressure()
  - sk_mem_reclaim()

and these on receive side:

  - sk_mem_charge()
  - sk_mem_uncharge()
  - sk_rmem_schedule()
  - sk_under_memory_pressure()
  - sk_mem_reclaim()

With sctp memory accounting, we can limit the memory allocation by
either sysctl:

  # sysctl -w net.sctp.sctp_mem="10 20 50"

or cgroup:

  # echo $((8<<14)) > \
    /sys/fs/cgroup/memory/sctp_mem/memory.kmem.tcp.limit_in_bytes

When the socket is under memory pressure, the send side will block
and wait, while the receive side will renege or drop.

v1->v2:
  - add the missing Reported/Tested/Acked/-bys.

Xin Long (2):
  sctp: implement memory accounting on tx path
  sctp: implement memory accounting on rx path

 include/net/sctp/sctp.h |  2 +-
 net/sctp/sm_statefuns.c |  6 ++++--
 net/sctp/socket.c       | 10 ++++++++--
 net/sctp/ulpevent.c     | 19 ++++++++-----------
 net/sctp/ulpqueue.c     |  3 ++-
 5 files changed, 23 insertions(+), 17 deletions(-)

-- 
2.1.0

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

end of thread, other threads:[~2019-04-15 20:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-15  9:15 [PATCHv2 net-next 0/2] sctp: fully support memory accounting Xin Long
2019-04-15  9:15 ` Xin Long
2019-04-15  9:15 ` [PATCHv2 net-next 1/2] sctp: implement memory accounting on tx path Xin Long
2019-04-15  9:15   ` Xin Long
2019-04-15  9:15   ` [PATCHv2 net-next 2/2] sctp: implement memory accounting on rx path Xin Long
2019-04-15  9:15     ` Xin Long
2019-04-15 20:37 ` [PATCHv2 net-next 0/2] sctp: fully support memory accounting David Miller
2019-04-15 20:37   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.