Message ID | 20230613080921.1623219-1-houtao@huaweicloud.com (mailing list archive) |
---|---|
Headers | show |
Series | Add benchmark for bpf memory allocator | expand |
Hello: This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <ast@kernel.org>: On Tue, 13 Jun 2023 16:09:16 +0800 you wrote: > From: Hou Tao <houtao1@huawei.com> > > Hi, > > This patchset includes some trivial fixes for benchmark framework and > a new benchmark for bpf memory allocator originated from handle-reuse > patchset. Because htab-mem benchmark depends the fixes, so I post these > patches together. > > [...] Here is the summary with links: - [bpf-next,v6,1/5] selftests/bpf: Use producer_cnt to allocate local counter array https://git.kernel.org/bpf/bpf-next/c/8ad663d3dfac - [bpf-next,v6,2/5] selftests/bpf: Output the correct error code for pthread APIs https://git.kernel.org/bpf/bpf-next/c/ea400d13fc92 - [bpf-next,v6,3/5] selftests/bpf: Ensure that next_cpu() returns a valid CPU number https://git.kernel.org/bpf/bpf-next/c/da77ae2b27ec - [bpf-next,v6,4/5] selftests/bpf: Set the default value of consumer_cnt as 0 https://git.kernel.org/bpf/bpf-next/c/970308a7b544 - [bpf-next,v6,5/5] selftests/bpf: Add benchmark for bpf memory allocator (no matching commit) You are awesome, thank you!
From: Hou Tao <houtao1@huawei.com> Hi, This patchset includes some trivial fixes for benchmark framework and a new benchmark for bpf memory allocator originated from handle-reuse patchset. Because htab-mem benchmark depends the fixes, so I post these patches together. Patch #1 fixes the allocation of local counter. Patch #2 fixes the outputted error code in error message when using pthead APIs. Patch #3 makes the benchmark run successfuly when the number of consumers and producers are greater than the number of online CPUs. Patch #4 sets the default value of consumer_cnt as 0, so all online CPUs could be used by producer threads. Patch #5 adds a new bpf memory allocator benchmark to measure the performance and memory usage of bpf hash table map. Please see individual patches for more details. Comments and suggestions are always welcome. Change Log: v6: * add fix patches for benchmark framework * updates for htab-mem benchmark (Most of updates are suggested by Alexei) * remove --full and --max-entries and use a fixed 8k size for htab * remove op_factor and increase op_cnt correctly * use -a instead of --prod-affinity in run_bench_htab_mem.sh * use $RUN_BENCH in run_bench_htab_mem.sh * call cleanup_cgroup_environment() at the end of htab_mem_report_final() v5: https://lore.kernel.org/bpf/ff4b2396-48aa-28f1-c91b-7c8a4b9510bb@huaweicloud.com/ * send the benchmark patch alone (suggested by Alexei) * limit the max number of touched elements per-bpf-program call to 64 (from Alexei) * show per-producer performance (from Alexei) * handle the return value of read() (from BPF CI) * do cleanup_cgroup_environment() in htab_mem_report_final() v4: https://lore.kernel.org/bpf/20230606035310.4026145-1-houtao@huaweicloud.com/ Hou Tao (5): selftests/bpf: Use producer_cnt to allocate local counter array selftests/bpf: Output the correct error code for pthread APIs selftests/bpf: Ensure that next_cpu() returns a valid CPU number selftests/bpf: Set the default value of consumer_cnt as 0 selftests/bpf: Add benchmark for bpf memory allocator tools/testing/selftests/bpf/Makefile | 3 + tools/testing/selftests/bpf/bench.c | 19 +- tools/testing/selftests/bpf/bench.h | 1 + .../bpf/benchs/bench_bloom_filter_map.c | 14 +- .../benchs/bench_bpf_hashmap_full_update.c | 10 +- .../bpf/benchs/bench_bpf_hashmap_lookup.c | 10 +- .../selftests/bpf/benchs/bench_bpf_loop.c | 10 +- .../selftests/bpf/benchs/bench_count.c | 14 +- .../selftests/bpf/benchs/bench_htab_mem.c | 303 ++++++++++++++++++ .../bpf/benchs/bench_local_storage.c | 12 +- .../bpf/benchs/bench_local_storage_create.c | 8 +- .../bench_local_storage_rcu_tasks_trace.c | 10 +- .../selftests/bpf/benchs/bench_rename.c | 15 +- .../selftests/bpf/benchs/bench_ringbufs.c | 2 +- .../selftests/bpf/benchs/bench_strncmp.c | 11 +- .../selftests/bpf/benchs/bench_trigger.c | 21 +- .../bpf/benchs/run_bench_htab_mem.sh | 40 +++ .../bpf/benchs/run_bench_ringbufs.sh | 26 +- .../selftests/bpf/progs/htab_mem_bench.c | 107 +++++++ 19 files changed, 502 insertions(+), 134 deletions(-) create mode 100644 tools/testing/selftests/bpf/benchs/bench_htab_mem.c create mode 100755 tools/testing/selftests/bpf/benchs/run_bench_htab_mem.sh create mode 100644 tools/testing/selftests/bpf/progs/htab_mem_bench.c