selftests/bpf: Use producer_cnt to allocate local counter array
authorHou Tao <houtao1@huawei.com>
Tue, 13 Jun 2023 08:09:17 +0000 (16:09 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 19 Jun 2023 20:26:42 +0000 (13:26 -0700)
For count-local benchmark, use producer_cnt instead of consumer_cnt when
allocating local counter array.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20230613080921.1623219-2-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/benchs/bench_count.c

index 078972ce208e67023e23f11b790ff2ab1c679a9d..3768945ad08e9e6eec8b59b7dd22b1b19d10a445 100644 (file)
@@ -40,7 +40,7 @@ static void count_local_setup(void)
 {
        struct count_local_ctx *ctx = &count_local_ctx;
 
-       ctx->hits = calloc(env.consumer_cnt, sizeof(*ctx->hits));
+       ctx->hits = calloc(env.producer_cnt, sizeof(*ctx->hits));
        if (!ctx->hits)
                exit(1);
 }