All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Joanne Koong <joannekoong@fb.com>
Cc: bpf <bpf@vger.kernel.org>, Andrii Nakryiko <andrii@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH v3 bpf-next 4/4] selftest/bpf/benchs: add bpf_loop benchmark
Date: Mon, 29 Nov 2021 15:02:16 -0800	[thread overview]
Message-ID: <CAEf4BzauvgM0zd1f5UX2rAqHG2cgp0r578nvG_QRhmfN8i+jqw@mail.gmail.com> (raw)
In-Reply-To: <20211129223725.2770730-5-joannekoong@fb.com>

On Mon, Nov 29, 2021 at 2:39 PM Joanne Koong <joannekoong@fb.com> wrote:
>
> Add benchmark to measure the throughput and latency of the bpf_loop
> call.
>
> Testing this on my dev machine on 1 thread, the data is as follows:
>
>         nr_loops: 10
> bpf_loop - throughput: 198.519 ± 0.155 M ops/s, latency: 5.037 ns/op
>
>         nr_loops: 100
> bpf_loop - throughput: 247.448 ± 0.305 M ops/s, latency: 4.041 ns/op
>
>         nr_loops: 500
> bpf_loop - throughput: 260.839 ± 0.380 M ops/s, latency: 3.834 ns/op
>
>         nr_loops: 1000
> bpf_loop - throughput: 262.806 ± 0.629 M ops/s, latency: 3.805 ns/op
>
>         nr_loops: 5000
> bpf_loop - throughput: 264.211 ± 1.508 M ops/s, latency: 3.785 ns/op
>
>         nr_loops: 10000
> bpf_loop - throughput: 265.366 ± 3.054 M ops/s, latency: 3.768 ns/op
>
>         nr_loops: 50000
> bpf_loop - throughput: 235.986 ± 20.205 M ops/s, latency: 4.238 ns/op
>
>         nr_loops: 100000
> bpf_loop - throughput: 264.482 ± 0.279 M ops/s, latency: 3.781 ns/op
>
>         nr_loops: 500000
> bpf_loop - throughput: 309.773 ± 87.713 M ops/s, latency: 3.228 ns/op
>
>         nr_loops: 1000000
> bpf_loop - throughput: 262.818 ± 4.143 M ops/s, latency: 3.805 ns/op
>
> From this data, we can see that the latency per loop decreases as the
> number of loops increases. On this particular machine, each loop had an
> overhead of about ~4 ns, and we were able to run ~250 million loops
> per second.
>
> Signed-off-by: Joanne Koong <joannekoong@fb.com>
> ---

LGTM.

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>  tools/testing/selftests/bpf/Makefile          |   4 +-
>  tools/testing/selftests/bpf/bench.c           |  37 ++++++
>  tools/testing/selftests/bpf/bench.h           |   2 +
>  .../selftests/bpf/benchs/bench_bpf_loop.c     | 105 ++++++++++++++++++
>  .../bpf/benchs/run_bench_bpf_loop.sh          |  15 +++
>  .../selftests/bpf/benchs/run_common.sh        |  15 +++
>  .../selftests/bpf/progs/bpf_loop_bench.c      |  26 +++++
>  7 files changed, 203 insertions(+), 1 deletion(-)
>  create mode 100644 tools/testing/selftests/bpf/benchs/bench_bpf_loop.c
>  create mode 100755 tools/testing/selftests/bpf/benchs/run_bench_bpf_loop.sh
>  create mode 100644 tools/testing/selftests/bpf/progs/bpf_loop_bench.c

[...]

  reply	other threads:[~2021-11-29 23:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 22:37 [PATCH v3 bpf-next 0/4] Add bpf_loop helper Joanne Koong
2021-11-29 22:37 ` [PATCH v3 bpf-next 1/4] bpf: " Joanne Koong
2021-11-29 22:48   ` Andrii Nakryiko
2021-11-30 16:54   ` Toke Høiland-Jørgensen
2021-11-29 22:37 ` [PATCH v3 bpf-next 2/4] selftests/bpf: Add bpf_loop test Joanne Koong
2021-11-29 22:52   ` Andrii Nakryiko
2021-11-29 22:37 ` [PATCH v3 bpf-next 3/4] selftests/bpf: measure bpf_loop verifier performance Joanne Koong
2021-11-29 22:55   ` Andrii Nakryiko
2021-11-29 22:37 ` [PATCH v3 bpf-next 4/4] selftest/bpf/benchs: add bpf_loop benchmark Joanne Koong
2021-11-29 23:02   ` Andrii Nakryiko [this message]
2021-11-30 16:53   ` Toke Høiland-Jørgensen

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=CAEf4BzauvgM0zd1f5UX2rAqHG2cgp0r578nvG_QRhmfN8i+jqw@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=Kernel-team@fb.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=joannekoong@fb.com \
    /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.