diff options
author | 2022-09-02 14:10:49 -0700 | |
---|---|---|
committer | 2022-09-05 15:33:06 +0200 | |
commit | 0fd7c5d43339b783ee3301a05f925d1e52ac87c9 (patch) | |
tree | b19c7f9b83221183677889fd7644b11549453de3 /drivers/net/dsa/microchip | |
parent | bpf: Optimize element count in non-preallocated hash map. (diff) | |
download | linux-dev-0fd7c5d43339b783ee3301a05f925d1e52ac87c9.tar.xz linux-dev-0fd7c5d43339b783ee3301a05f925d1e52ac87c9.zip |
bpf: Optimize call_rcu in non-preallocated hash map.
Doing call_rcu() million times a second becomes a bottle neck.
Convert non-preallocated hash map from call_rcu to SLAB_TYPESAFE_BY_RCU.
The rcu critical section is no longer observed for one htab element
which makes non-preallocated hash map behave just like preallocated hash map.
The map elements are released back to kernel memory after observing
rcu critical section.
This improves 'map_perf_test 4' performance from 100k events per second
to 250k events per second.
bpf_mem_alloc + percpu_counter + typesafe_by_rcu provide 10x performance
boost to non-preallocated hash map and make it within few % of preallocated map
while consuming fraction of memory.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220902211058.60789-8-alexei.starovoitov@gmail.com
Diffstat (limited to 'drivers/net/dsa/microchip')
0 files changed, 0 insertions, 0 deletions