BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org, ast@kernel.org
Cc: andrii@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
	 kernel-team@fb.com, yonghong.song@linux.dev,
	martin.lau@kernel.org, clm@meta.com, 	ihor.solodrai@linux.dev
Subject: Re: [PATCH RFC bpf-next 2/6] bpf: compute loops hierarchy
Date: Tue, 26 May 2026 04:18:16 -0700	[thread overview]
Message-ID: <ed4fba3c27ebbfdfd8dca50d52c05e0f4c9001fc.camel@gmail.com> (raw)
In-Reply-To: <17990ac45a42c5a9b8147bd9fbac3760467fe44b4e5ef8068da3c9a4aaa3ee5f@mail.kernel.org>

On Tue, 2026-05-26 at 10:05 +0000, bot+bpf-ci@kernel.org wrote:

[...]

> > +int bpf_compute_loops(struct bpf_verifier_env *env)
> > +{
> > +	struct bpf_insn_aux_data *aux = env->insn_aux_data;
> > +	int i, err = 0, len = env->prog->len;
> > +	struct loops_dfs dfs = {};
> > +
> > +	dfs.dfs_pos = kvcalloc(len, sizeof(int), GFP_KERNEL_ACCOUNT);
> > +	dfs.state = kvcalloc(len, sizeof(struct dfs_state), GFP_KERNEL_ACCOUNT);
> > +	dfs.stack = kvcalloc(len, sizeof(int), GFP_KERNEL_ACCOUNT);
> > +	if (!dfs.dfs_pos || !dfs.state || !dfs.stack) {
> > +		err = -ENOMEM;
> > +		goto out;
> > +	}
> > +	for (i = 0; i < len; i++)
> > +		aux[i].loop_header = -1;
> > +	for (i = 0; i < env->subprog_cnt; i++) {
> > +		err = compute_loops_in_subprog(env, &dfs, i);
> > +		if (err)
> > +			goto out;
> > +	}
> > +
> > +out:
> > +	kfree(dfs.dfs_pos);
> > +	kfree(dfs.stack);
> > +	kfree(dfs.state);
> > +	return err;
> > +}
> 
> Should this use kvfree() instead of kfree()? The three buffers are
> allocated with kvcalloc(), which can return either kmalloc or vmalloc
> memory depending on size. With env->prog->len up to 1,000,000
> instructions, these allocations can easily exceed kmalloc's maximum
> size and fall back to vmalloc.

It should use kvfree(), yes.

  reply	other threads:[~2026-05-26 11:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  9:30 [PATCH RFC bpf-next 0/6] bpf: better error reporting when verifier hits 1M instructions limit Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 1/6] bpf: move live registers and scc printout to a standalone function Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 2/6] bpf: compute loops hierarchy Eduard Zingerman
2026-05-26 10:05   ` bot+bpf-ci
2026-05-26 11:18     ` Eduard Zingerman [this message]
2026-05-26 10:07   ` sashiko-bot
2026-05-26  9:30 ` [PATCH RFC bpf-next 3/6] selftests/bpf: test cases for loop hierarchy computation Eduard Zingerman
2026-05-26 10:25   ` sashiko-bot
2026-05-26 11:22     ` Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 4/6] bpf: report hot simulated callchains when 1M instructions limit is met Eduard Zingerman
2026-05-26 10:05   ` bot+bpf-ci
2026-05-26 11:24     ` Eduard Zingerman
2026-05-26 10:45   ` sashiko-bot
2026-05-26 11:31     ` Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 5/6] bpf: report register diff summary for hot callchains Eduard Zingerman
2026-05-26 10:05   ` bot+bpf-ci
2026-05-26 11:11   ` sashiko-bot
2026-05-26 11:36     ` Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 6/6] selftests/bpf: test budget exhaustion profiling report 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=ed4fba3c27ebbfdfd8dca50d52c05e0f4c9001fc.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox