[PATCH bpf-next 0/6] New benchmark for hashmap lookups

Anton Protopopov
2023-01-27T18:15:54Z

Add a new benchmark for hashmap lookups and fix several typos. See individual
commits for descriptions.

One thing to mention here is that in commit 3 I've patched bench so that now
command line options can be reused by different benchmarks.

The benchmark itself is added in the last commit 6. I am using this benchmark
to test map lookup productivity when using a different hash function (see
https://fosdem.org/2023/schedule/event/bpf_hashing/). The results provided by
the benchmark look reasonable and match the results of my different benchmarks
(requiring to patch kernel to get actual statistics on map lookups).

Anton Protopopov (6):
selftest/bpf/benchs: fix a typo in bpf_hashmap_full_update
selftest/bpf/benchs: make a function static in bpf_hashmap_full_update
selftest/bpf/benchs: enhance argp parsing
selftest/bpf/benchs: make quiet option common
selftest/bpf/benchs: print less if the quiet option is set
selftest/bpf/benchs: Add benchmark for hashmap lookups

tools/testing/selftests/bpf/Makefile | 5 +-
tools/testing/selftests/bpf/bench.c | 126 +++++++-
tools/testing/selftests/bpf/bench.h | 24 ++
.../bpf/benchs/bench_bloom_filter_map.c | 6 -
.../benchs/bench_bpf_hashmap_full_update.c | 4 +-
.../bpf/benchs/bench_bpf_hashmap_lookup.c | 277 ++++++++++++++++++
.../selftests/bpf/benchs/bench_bpf_loop.c | 4 -
.../bpf/benchs/bench_local_storage.c | 5 -
.../bench_local_storage_rcu_tasks_trace.c | 20 +-
.../selftests/bpf/benchs/bench_ringbufs.c | 8 -
.../selftests/bpf/benchs/bench_strncmp.c | 4 -
.../run_bench_bpf_hashmap_full_update.sh | 2 +-
.../selftests/bpf/progs/bpf_hashmap_lookup.c | 61 ++++
13 files changed, 486 insertions(+), 60 deletions(-)
create mode 100644 tools/testing/selftests/bpf/benchs/bench_bpf_hashmap_lookup.c
create mode 100644 tools/testing/selftests/bpf/progs/bpf_hashmap_lookup.c

--
2.34.1