BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: wujing <realwujing@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	 Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	 Yonghong Song <yonghong.song@linux.dev>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>,
	 Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>,
	bpf@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Qiliang Yuan <yuanql9@chinatelecom.cn>
Subject: Re: [PATCH] bpf/verifier: compress bpf_reg_state by using bitfields
Date: Thu, 15 Jan 2026 10:55:30 -0800	[thread overview]
Message-ID: <7ffce4afdb0e859df7f0f87d170eda31b66a5b2b.camel@gmail.com> (raw)
In-Reply-To: <20260115152037.449362-1-realwujing@gmail.com>

On Thu, 2026-01-15 at 23:20 +0800, wujing wrote:
> The struct bpf_reg_state is 112 bytes long on 64-bit architectures,
> with several fields that have limited ranges. In particular, the bool
> 'precise' at the end causes 7 bytes of padding.
> 
> This patch packs 'frameno', 'subreg_def', and 'precise' into a single
> u32/s32 bitfield block:
> - frameno: 4 bits (sufficient for MAX_CALL_FRAMES=8)
> - subreg_def: 27 bits (sufficient for 1M insns limit)
> - precise: 1 bit
> 
> This reduces the size of struct bpf_reg_state from 112 to 104 bytes,
> saving 8 bytes per register. This also reduces the size of
> struct bpf_stack_state. Overall, it reduces peak memory usage of the
> verifier for complex programs with millions of states.
> 
> The patch also updates states_maybe_looping() to use a non-bitfield
> boundary for memcmp(), as offsetof() cannot be used on bitfields.
> 
> Signed-off-by: wujing <realwujing@gmail.com>
> Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
> ---

varistat collects verifier memory usage statistics.
Does this change has an impact on programs generated for
e.g. selftests and sched_ext?

In general, you posted 4 patches claiming performance improvements,
but non of them are supported by any measurements.

P.S.
Is this LLM-generated?

  reply	other threads:[~2026-01-15 18:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 15:20 [PATCH] bpf/verifier: compress bpf_reg_state by using bitfields wujing
2026-01-15 18:55 ` Eduard Zingerman [this message]
2026-01-16  6:07   ` Qiliang Yuan
2026-01-16  6:51     ` 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=7ffce4afdb0e859df7f0f87d170eda31b66a5b2b.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=haoluo@google.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=realwujing@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    --cc=yuanql9@chinatelecom.cn \
    /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