diff options
author | Xin Long <lucien.xin@gmail.com> | 2019-04-15 17:15:06 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-15 13:36:51 -0700 |
commit | 1033990ac5b2ab6cee93734cb6d301aa3a35bcaa (patch) | |
tree | 7aed5c7a91b42d588c86e22b1d094e708b6b585f /net/sctp/sm_statefuns.c | |
parent | 93144b0ecde584e1e480abf45429ef47a5e02ac9 (diff) |
sctp: implement memory accounting on tx path
Now when sending packets, sk_mem_charge() and sk_mem_uncharge() have been
used to set sk_forward_alloc. We just need to call sk_wmem_schedule() to
check if the allocated should be raised, and call sk_mem_reclaim() to
check if the allocated should be reduced when it's under memory pressure.
If sk_wmem_schedule() returns false, which means no memory is allowed to
allocate, it will block and wait for memory to become available.
Note different from tcp, sctp wait_for_buf happens before allocating any
skb, so memory accounting check is done with the whole msg_len before it
too.
Reported-by: Matteo Croce <mcroce@redhat.com>
Tested-by: Matteo Croce <mcroce@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/sm_statefuns.c')
0 files changed, 0 insertions, 0 deletions