From: Hou Tao <houtao1@xxxxxxxxxx> Hi, Beside adding a simple prepare patch, v7 mainly addresses suggestions from Alexei. As ususal, comments and suggestions are always welcome. Change Log: v7: * Rename name of producer threads to avoid confusion * Make the comments in producer threads more clear * Remove unnecessary check of ctx->from in bpf program * Split add_del_on_diff bpf program to two bpf program for clarity v6: https://lore.kernel.org/bpf/20230613080921.1623219-1-houtao@xxxxxxxxxxxxxxx/ * 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@xxxxxxxxxxxxxxx/ * 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@xxxxxxxxxxxxxxx/ Hou Tao (2): selftests/bpf: Add min() and max() macros in bpf_util.h selftests/bpf: Add benchmark for bpf memory allocator tools/testing/selftests/bpf/Makefile | 3 + tools/testing/selftests/bpf/bench.c | 4 + .../selftests/bpf/benchs/bench_htab_mem.c | 345 ++++++++++++++++++ .../bpf/benchs/run_bench_htab_mem.sh | 40 ++ tools/testing/selftests/bpf/bpf_util.h | 7 + .../selftests/bpf/progs/htab_mem_bench.c | 105 ++++++ 6 files changed, 504 insertions(+) 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 -- 2.29.2