bpf: populate the per-cpu insertions/deletions counters for hashmaps
authorAnton Protopopov <aspsk@isovalent.com>
Thu, 6 Jul 2023 13:39:30 +0000 (13:39 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 6 Jul 2023 19:42:25 +0000 (12:42 -0700)
commit9bc421b6be955c0960356210960d82707aa009e8
treef57af088ca4bb96965c2369626f13b187ea6d0d7
parent803370d3d37579e080e8c59f2360a072d0e45aff
bpf: populate the per-cpu insertions/deletions counters for hashmaps

Initialize and utilize the per-cpu insertions/deletions counters for hash-based
maps. Non-trivial changes only apply to the preallocated maps for which the
{inc,dec}_elem_count functions are not called, as there's no need in counting
elements to sustain proper map operations.

To increase/decrease percpu counters for preallocated maps we add raw calls to
the bpf_map_{inc,dec}_elem_count functions so that the impact is minimal. For
dynamically allocated maps we add corresponding calls to the existing
{inc,dec}_elem_count functions.

Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
Link: https://lore.kernel.org/r/20230706133932.45883-4-aspsk@isovalent.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/hashtab.c