Re: [PATCH bpf-next 0/2] bpf: Add benchmark for bpf memory allocator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 12/21/2023 10:14 PM, Hou Tao wrote:
> From: Hou Tao <houtao1@xxxxxxxxxx>
>
> Hi,
>
> The patch set aims to add a benchmark for bpf memory allocator to test
> both its alloc/free ratio and the memory usage.
>
> Patch #1 is a preparatory patch which moves bench specific metrics into
> union of structs, so newly-added benchmark can add metrics which doesn't
> fit with the existing one easily. Patch #2 is the benchmark patch. It
> tests the performance through the following steps:
> 1) find the inner array by using the cpu number as key
> 2) allocate at most 64 128-bytes-sized objects through bpf_obj_new()
> 3) stash these objectes into the inner array through bpf_kptr_xchg()
> 4) account the time used in step 1)~3)
> 5) calculate the performance in M/s: alloc_cnt * 1000 / alloc_tim_ns
> 6) calculate the memory usage by reading slub field in memory.stat file
>    and get the final value after subtracting the base value.
>
> Please see individual patches for more details. And comments are always
> welcome.

Ping? It seems the patch set has been removed from PR queue of
kernel-patches/bpf, but I want to get some feedback before posting a v2
(need to update the benchmark result due to the merge of "bpf: Reduce
memory usage for bpf_global_percpu_ma​" patch set).
>
> Hou Tao (2):
>   selftests/bpf: Move bench specific metrics into union of structs
>   selftests/bpf: Add benchmark for bpf memory allocator
>
>  tools/testing/selftests/bpf/Makefile          |   2 +
>  tools/testing/selftests/bpf/bench.c           |  13 +-
>  tools/testing/selftests/bpf/bench.h           |  22 +-
>  .../selftests/bpf/benchs/bench_bpf_ma.c       | 273 ++++++++++++++++++
>  .../selftests/bpf/benchs/bench_htab_mem.c     |  10 +-
>  .../bench_local_storage_rcu_tasks_trace.c     |  10 +-
>  .../selftests/bpf/progs/bench_bpf_ma.c        | 222 ++++++++++++++
>  7 files changed, 535 insertions(+), 17 deletions(-)
>  create mode 100644 tools/testing/selftests/bpf/benchs/bench_bpf_ma.c
>  create mode 100644 tools/testing/selftests/bpf/progs/bench_bpf_ma.c
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux