mbox series

[bpf-next,v2,0/7] New benchmark for hashmap lookups

Message ID 20230213091519.1202813-1-aspsk@isovalent.com (mailing list archive)
Headers show
Series New benchmark for hashmap lookups | expand

Message

Anton Protopopov Feb. 13, 2023, 9:15 a.m. UTC
Add a new benchmark for hashmap lookups and fix several typos.

In commit 3 I've patched the bench utility so that now command line options
can be reused by different benchmarks.

The benchmark itself is added in the last commit 7. I was using this benchmark
to test map lookup productivity when using a different hash function [1]. When
run with --quiet, the results can be easily plotted [2].  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).

Links:
  [1] https://fosdem.org/2023/schedule/event/bpf_hashing/
  [2] https://github.com/aspsk/bpf-bench/tree/master/hashmap-bench

Changes,
v1->v2:
- percpu_times_index[] is of wrong size (Martin)
- use base 0 for strtol (Andrii)
- just use -q without argument (Andrii)
- use less hacks when parsing arguments (Andrii)

Anton Protopopov (7):
  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: remove an unused header
  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           |  59 +++-
 tools/testing/selftests/bpf/bench.h           |   2 +
 .../bpf/benchs/bench_bloom_filter_map.c       |   5 +
 .../benchs/bench_bpf_hashmap_full_update.c    |   5 +-
 .../bpf/benchs/bench_bpf_hashmap_lookup.c     | 283 ++++++++++++++++++
 .../selftests/bpf/benchs/bench_bpf_loop.c     |   1 +
 .../bpf/benchs/bench_local_storage.c          |   3 +
 .../bench_local_storage_rcu_tasks_trace.c     |  16 +-
 .../selftests/bpf/benchs/bench_ringbufs.c     |   4 +
 .../selftests/bpf/benchs/bench_strncmp.c      |   2 +
 .../run_bench_bpf_hashmap_full_update.sh      |   2 +-
 ...run_bench_local_storage_rcu_tasks_trace.sh |   2 +-
 .../selftests/bpf/progs/bpf_hashmap_lookup.c  |  63 ++++
 14 files changed, 420 insertions(+), 32 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

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 16, 2023, 12:40 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Mon, 13 Feb 2023 09:15:12 +0000 you wrote:
> Add a new benchmark for hashmap lookups and fix several typos.
> 
> In commit 3 I've patched the bench utility so that now command line options
> can be reused by different benchmarks.
> 
> The benchmark itself is added in the last commit 7. I was using this benchmark
> to test map lookup productivity when using a different hash function [1]. When
> run with --quiet, the results can be easily plotted [2].  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).
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2,1/7] selftest/bpf/benchs: fix a typo in bpf_hashmap_full_update
    https://git.kernel.org/bpf/bpf-next/c/4db98ab445c5
  - [bpf-next,v2,2/7] selftest/bpf/benchs: make a function static in bpf_hashmap_full_update
    https://git.kernel.org/bpf/bpf-next/c/2f1c59637fb1
  - [bpf-next,v2,3/7] selftest/bpf/benchs: enhance argp parsing
    https://git.kernel.org/bpf/bpf-next/c/22ff7aeaa9e3
  - [bpf-next,v2,4/7] selftest/bpf/benchs: remove an unused header
    https://git.kernel.org/bpf/bpf-next/c/9644546260ea
  - [bpf-next,v2,5/7] selftest/bpf/benchs: make quiet option common
    https://git.kernel.org/bpf/bpf-next/c/90c22503cd89
  - [bpf-next,v2,6/7] selftest/bpf/benchs: print less if the quiet option is set
    https://git.kernel.org/bpf/bpf-next/c/a237dda05e91
  - [bpf-next,v2,7/7] selftest/bpf/benchs: Add benchmark for hashmap lookups
    https://git.kernel.org/bpf/bpf-next/c/f371f2dc53d1

You are awesome, thank you!