net: implement per-cpu reserves for memory_allocated
authorEric Dumazet <edumazet@google.com>
Thu, 9 Jun 2022 06:34:09 +0000 (23:34 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 10 Jun 2022 23:21:26 +0000 (16:21 -0700)
commit3cd3399dd7a84ada85cb839989cdf7310e302c7d
tree8e815ea9747b1e3e1a7ca89414f4f9f35f3bf185
parent0defbb0af775ef037913786048d099bbe8b9a2c2
net: implement per-cpu reserves for memory_allocated

We plan keeping sk->sk_forward_alloc as small as possible
in future patches.

This means we are going to call sk_memory_allocated_add()
and sk_memory_allocated_sub() more often.

Implement a per-cpu cache of +1/-1 MB, to reduce number
of changes to sk->sk_prot->memory_allocated, which
would otherwise be cause of false sharing.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/sock.h