All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Joanne Koong <joannekoong@fb.com>, bpf@vger.kernel.org
Cc: andrii@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	kafai@fb.com, Kernel-team@fb.com,
	Joanne Koong <joannekoong@fb.com>
Subject: Re: [PATCH bpf-next 0/3] Add bpf_for_each helper
Date: Thu, 18 Nov 2021 12:14:08 +0100	[thread overview]
Message-ID: <87tug9emwv.fsf@toke.dk> (raw)
In-Reply-To: <20211118010404.2415864-1-joannekoong@fb.com>

Joanne Koong <joannekoong@fb.com> writes:

> This patchset add a new helper, bpf_for_each.
>
> One of the complexities of using for loops in bpf programs is that the verifier
> needs to ensure that in every possibility of the loop logic, the loop will always
> terminate. As such, there is a limit on how many iterations the loop can do.
>
> The bpf_for_each helper moves the loop logic into the kernel and can thereby
> guarantee that the loop will always terminate. The bpf_for_each helper simplifies
> a lot of the complexity the verifier needs to check, as well as removes the
> constraint on the number of loops able to be run.
>
> From the test results, we see that using bpf_for_each in place
> of the traditional for loop led to a decrease in verification time
> and number of bpf instructions by 100%. The benchmark results show
> that as the number of iterations increases, the overhead per iteration
> decreases.

Small nit with the "by 100%" formulation: when giving such relative
quantities 100% has a particular meaning, namely "eliminates entirely".
Which this doesn't, obviously, it *almost* eliminates the verification
overhead. So I'd change this to 99.5% instead (which is the actual value
from your numbers in patch 2).


  parent reply	other threads:[~2021-11-18 11:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18  1:04 [PATCH bpf-next 0/3] Add bpf_for_each helper Joanne Koong
2021-11-18  1:04 ` [PATCH bpf-next 1/3] bpf: " Joanne Koong
2021-11-18 11:11   ` Toke Høiland-Jørgensen
2021-11-18 18:03     ` Yonghong Song
2021-11-19 12:17       ` Toke Høiland-Jørgensen
2021-11-18 17:59   ` Yonghong Song
2021-11-19  2:40     ` Joanne Koong
2021-11-18 20:14   ` Andrii Nakryiko
     [not found]     ` <9cf25708-c878-65db-0dfd-a76e83fe9e39@fb.com>
2021-11-19 21:50       ` Joanne Koong
2021-11-18  1:04 ` [PATCH bpf-next 2/3] selftests/bpf: Add tests for bpf_for_each Joanne Koong
2021-11-18 20:23   ` Andrii Nakryiko
2021-11-18  1:04 ` [PATCH bpf-next 3/3] selftest/bpf/benchs: add bpf_for_each benchmark Joanne Koong
2021-11-18 11:18   ` Toke Høiland-Jørgensen
2021-11-18 19:55     ` Andrii Nakryiko
2021-11-19 13:04       ` Toke Høiland-Jørgensen
2021-11-19 22:50         ` Andrii Nakryiko
2021-11-22 14:27           ` Toke Høiland-Jørgensen
2021-11-18 20:00   ` Andrii Nakryiko
2021-11-18 11:14 ` Toke Høiland-Jørgensen [this message]
2021-11-19  2:35   ` [PATCH bpf-next 0/3] Add bpf_for_each helper Joanne Koong

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=87tug9emwv.fsf@toke.dk \
    --to=toke@redhat.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 \
    --cc=kafai@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.