Re: [PATCH bpf-next] selftests/bpf: Add kptr-xchg benchmark

Andrii Nakryiko <[email protected]>
Newsgroups org.kernel.vger.linux-kselftest,org.kernel.vger.bpf
Message-ID <CAEf4BzY9YaeT4CssCe13uAWXYHXs6HervsCo0Puc0osfr8=yVw@mail.gmail.com>
On Sun, Aug 9, 2026 at 10:57 PM Chenguang Zhao <[email protected]> wrote:
>
> From: Chenguang Zhao <[email protected]>
>
> Add a microbenchmark that repeatedly calls bpf_kptr_xchg() from an
> fentry program. Architectures that advertise bpf_jit_supports_ptr_xchg()
> inline the helper to BPF_XCHG; others keep the helper call. This bench
> makes it easy to compare the two paths under the same workload.

but do we need a permanent benchmark for this? Is there any valid risk
of regressing performance here? Unless there is a good reason to have
this benchmark readily available for everyone to periodically run or
something, I'm inclined to reject new benchmarks and minimize amount
of code maintenance burden for something like this, sorry.

pw-bot: cr

>
> Usage:
>   sudo ./bench -d 30 -w 5 -p 1 kptr-xchg --nr_loops 256
>
> Signed-off-by: Chenguang Zhao <[email protected]>
> ---
> Example results on LoongArch64 (helper vs inlined):
>

[...]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.