selftests/bpf: Test all valid alloc sizes for bpf mem allocator
authorHou Tao <houtao1@huawei.com>
Fri, 8 Sep 2023 13:39:23 +0000 (21:39 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 11 Sep 2023 19:41:37 +0000 (12:41 -0700)
commitf0a42ab5890f749626b35f9fddd8d0704fc89524
tree7a64861ed83752ac413a6fa9e14969ee728442ff
parentc930472552022bd09aab3cd946ba3f243070d5c7
selftests/bpf: Test all valid alloc sizes for bpf mem allocator

Add a test to test all possible and valid allocation size for bpf
memory allocator. For each possible allocation size, the test uses
the following two steps to test the alloc and free path:

1) allocate N (N > high_watermark) objects to trigger the refill
   executed in irq_work.
2) free N objects to trigger the freeing executed in irq_work.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20230908133923.2675053-5-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_bpf_ma.c [new file with mode: 0644]