[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7ffce4afdb0e859df7f0f87d170eda31b66a5b2b.camel@gmail.com>
Date: Thu, 15 Jan 2026 10:55:30 -0800
From: Eduard Zingerman <eddyz87@...il.com>
To: wujing <realwujing@...il.com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>
Cc: Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri
Olsa <jolsa@...nel.org>, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, Qiliang Yuan <yuanql9@...natelecom.cn>
Subject: Re: [PATCH] bpf/verifier: compress bpf_reg_state by using bitfields
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@...il.com>
> Signed-off-by: Qiliang Yuan <yuanql9@...natelecom.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?
Powered by blists - more mailing lists