All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Puranjay Mohan <puranjay@kernel.org>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	 Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Kumar Kartikeya Dwivedi	 <memxor@gmail.com>,
	Song Liu <song@kernel.org>,
	Yonghong Song	 <yonghong.song@linux.dev>
Subject: Re: [PATCH bpf-next v2 4/4] selftests/bpf: Add bpf_for() benchmark
Date: Fri, 17 Jul 2026 12:02:59 -0700	[thread overview]
Message-ID: <a6bff14e1eaaae768562fb2825693fa3c5568dee.camel@gmail.com> (raw)
In-Reply-To: <20260717120215.2171057-5-puranjay@kernel.org>

On Fri, 2026-07-17 at 05:02 -0700, Puranjay Mohan wrote:
> The bpf_for() macro builds on the numeric open-coded iterator kfuncs
> bpf_iter_num_{new,next,destroy}(). Add a benchmark, modelled on the
> existing bpf_loop benchmark, that repeatedly runs a bpf_for() loop so the
> per-iteration cost of the iterator can be measured, e.g. to quantify the
> effect of inlining the iterator kfuncs in the verifier.
> 
> The BPF program runs an inner bpf_for(i, 0, nr_loops) loop with an empty
> body 1000 times per trigger and accounts nr_loops hits per outer
> iteration, mirroring bench_bpf_loop so the two are directly comparable.
> 
> nr_loops defaults to 1000 so that the per-iteration bpf_iter_num_next()
> cost, rather than the one-time bpf_iter_num_new()/destroy() setup and
> teardown, dominates the reported numbers:
> 
>   $ ./bench -p 1 --nr_loops 1000 bpf-for
> 
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> ---

Could you please add a few tests with __xlated tag, e.g. as in:

  tools/testing/selftests/bpf/progs/epilogue_exit.c

To verify the shape of the inlined code?

  reply	other threads:[~2026-07-17 19:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 12:02 [PATCH bpf-next v2 0/4] bpf: Inline the numeric open-coded iterator kfuncs Puranjay Mohan
2026-07-17 12:02 ` [PATCH bpf-next v2 1/4] bpf: Inline bpf_iter_num_new() kfunc Puranjay Mohan
2026-07-17 19:30   ` Eduard Zingerman
2026-07-17 12:02 ` [PATCH bpf-next v2 2/4] bpf: Inline bpf_iter_num_next() kfunc Puranjay Mohan
2026-07-17 19:44   ` Eduard Zingerman
2026-07-17 12:02 ` [PATCH bpf-next v2 3/4] bpf: Inline bpf_iter_num_destroy() kfunc Puranjay Mohan
2026-07-17 19:45   ` Eduard Zingerman
2026-07-17 12:02 ` [PATCH bpf-next v2 4/4] selftests/bpf: Add bpf_for() benchmark Puranjay Mohan
2026-07-17 19:02   ` Eduard Zingerman [this message]
2026-07-17 19:57   ` Eduard Zingerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6bff14e1eaaae768562fb2825693fa3c5568dee.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=puranjay@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.