bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Lorenz Bauer <lmb@cloudflare.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	kernel-team <kernel-team@cloudflare.com>,
	Network Development <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next 0/3] Reduce kmalloc / kfree churn in the verifier
Date: Mon, 10 May 2021 17:55:59 -0700	[thread overview]
Message-ID: <CAADnVQJXbyB2LR=P9yzTR_OLQjOoCNh7QirQ5st8g7KJKAa6YQ@mail.gmail.com> (raw)
In-Reply-To: <20210429134656.122225-1-lmb@cloudflare.com>

On Thu, Apr 29, 2021 at 6:47 AM Lorenz Bauer <lmb@cloudflare.com> wrote:
>
> github.com/cilium/ebpf runs integration tests with libbpf in a vm on CI.
> I recently did some work to increase the code coverage from that, and
> started experiencing OOM-kills in the VM. That led me down a rabbit
> hole looking at verifier memory allocation patterns. I didn't figure out
> what triggered the OOM-kills but refactored some often called memory
> allocation code.
>
> The key insight is that often times we don't need to do a full kfree /
> kmalloc, but can instead just reallocate. The first patch adds two helpers
> which do just that for the use cases in the verifier, which are sufficiently
> different that they can't use stock krealloc_array and friends.
>
> The series makes bpf_verif_scale about 10% faster in my VM set up, which
> is especially noticeable when running with KASAN enabled.

The series looks great. Applied to bpf-next.

      parent reply	other threads:[~2021-05-11  0:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 13:46 [PATCH bpf-next 0/3] Reduce kmalloc / kfree churn in the verifier Lorenz Bauer
2021-04-29 13:46 ` [PATCH bpf-next 1/3] bpf: verifier: improve function state reallocation Lorenz Bauer
2021-04-29 13:46 ` [PATCH bpf-next 2/3] bpf: verifier: use copy_array for jmp_history Lorenz Bauer
2021-04-29 13:46 ` [PATCH bpf-next 3/3] bpf: verifier: allocate idmap scratch in verifier env Lorenz Bauer
2021-04-29 14:52   ` Edward Cree
2021-05-11  0:55 ` Alexei Starovoitov [this message]

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='CAADnVQJXbyB2LR=P9yzTR_OLQjOoCNh7QirQ5st8g7KJKAa6YQ@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@cloudflare.com \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).