Re: [PATCH 5/6] selftests/bpf: Test importing pages into an arena
From: bot+bpf-ci
Date: Sat Dec 05 2026 - 05:46:00 EST
> selftests/bpf: Test importing pages into an arena
TL;DR: Nit only: in the arena_import selftest, do_alloc(), do_import() and
do_import_dax() duplicate the setup and run logic of do_ext() and could call
it instead.
> diff --git a/tools/testing/selftests/bpf/prog_tests/arena_import.c b/tools/testing/selftests/bpf/prog_tests/arena_import.c
> new file mode 100644
> index 000000000000..9d2753bcc49e
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/arena_import.c
[ ... ]
> +static int do_ext(struct arena_import *skel, struct bpf_program *prog, __u32 pg, __u32 cnt)
> +{
> + skel->bss->pg = pg;
> + skel->bss->page_cnt = cnt;
> + skel->bss->ret = 1;
> + if (run(prog))
> + return 1;
> + return skel->bss->ret;
> +}
> +
> +static int do_alloc(struct arena_import *skel, __u32 pg, __u32 cnt)
> +{
> + skel->bss->pg = pg;
> + skel->bss->page_cnt = cnt;
> + skel->bss->ret = 1;
> + if (run(skel->progs.op_alloc))
> + return 1;
> + return skel->bss->ret;
> +}
This isn't a bug, but do_ext() is already the generic form of this
run-and-return-ret helper, and do_alloc() has the same body with the
program fixed to op_alloc.
do_import() and do_import_dax() repeat the same pg/page_cnt/ret = 1/run()/
return skel->bss->ret sequence after setting fd/fd_off or src, and
test_async() writes the same sequence inline before running
op_import_async.
Could do_alloc(), do_import() and do_import_dax() set their extra inputs
and then call do_ext() with their program, so the pg/page_cnt/ret setup
lives in one place?
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/47508970196