Re: [RFC PATCH bpf-next v4 2/3] selftests/bpf: Add benchmark for bpf memory allocator

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

 



On Mon, Jun 5, 2023 at 8:20 PM Hou Tao <houtao@xxxxxxxxxxxxxxx> wrote:
>
> +static void htab_mem_read_mem_cgrp_file(const char *name, unsigned long *value)
> +{
> +       char buf[32];
> +       int fd;
> +
> +       fd = openat(ctx.fd, name, O_RDONLY);
> +       if (fd < 0) {
> +               fprintf(stderr, "no %s\n", name);
> +               *value = 0;
> +               return;
> +       }
> +
> +       buf[sizeof(buf) - 1] = 0;
> +       read(fd, buf, sizeof(buf) - 1);

Please BPF CI. It's complaining about:

benchs/bench_htab_mem.c: In function ‘htab_mem_read_mem_cgrp_file’:
benchs/bench_htab_mem.c:290:2: error: ignoring return value of ‘read’,
declared with attribute warn_unused_result [-Werror=unused-result]
290 | read(fd, buf, sizeof(buf) - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


> +       *value = strtoull(buf, NULL, 0);
> +
> +       close(fd);
> +}
> +
> +static void htab_mem_measure(struct bench_res *res)
> +{
> +       res->hits = atomic_swap(&ctx.skel->bss->loop_cnt, 0);

This is missing:
res->hits /= env.producer_cnt;

Doubling the number of producers should double the perf metric.
Like -p 4 should be half the speed of -p 8.
In an ideal situation, of course.
Without this normalization -p 1 vs -p 2 numbers are meaningless.
Runs with different numbers of producers cannot be compared.





[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