From: Eduard Zingerman <eddyz87@gmail.com>
To: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org
Cc: daniel@iogearbox.net, martin.lau@linux.dev, kernel-team@fb.com,
yonghong.song@linux.dev, eddyz87@gmail.com
Subject: [PATCH bpf-next 0/2] bpf: unify state pruning handling of invalid/misc stack slots
Date: Tue, 30 Dec 2025 21:36:02 -0800 [thread overview]
Message-ID: <20251230-loop-stack-misc-pruning-v1-0-585cfd6cec51@gmail.com> (raw)
This change unifies states pruning handling of NOT_INIT registers,
STACK_INVALID/STACK_MISC stack slots for regular and iterator/callback
based loop cases.
The change results in a modest verifier performance improvement:
========= selftests: master vs loop-stack-misc-pruning =========
File Program Insns (A) Insns (B) Insns (DIFF)
------------------------------- -------------------- --------- --------- ----------------
test_tcp_custom_syncookie.bpf.o tcp_custom_syncookie 38307 18430 -19877 (-51.89%)
xdp_synproxy_kern.bpf.o syncookie_tc 23035 19067 -3968 (-17.23%)
xdp_synproxy_kern.bpf.o syncookie_xdp 21022 18516 -2506 (-11.92%)
Total progs: 4173
Old success: 2520
New success: 2521
total_insns diff min: -99.99%
total_insns diff max: 0.00%
0 -> value: 0
value -> 0: 0
total_insns abs max old: 837,487
total_insns abs max new: 837,487
-100 .. -90 %: 1
-60 .. -50 %: 3
-50 .. -40 %: 2
-40 .. -30 %: 2
-30 .. -20 %: 8
-20 .. -10 %: 4
-10 .. 0 %: 5
0 .. 5 %: 4148
========= scx: master vs loop-stack-misc-pruning =========
File Program Insns (A) Insns (B) Insns (DIFF)
------------------------- ---------------- --------- --------- ----------------
scx_arena_selftests.bpf.o arena_selftest 257545 243678 -13867 (-5.38%)
scx_chaos.bpf.o chaos_dispatch 13989 12804 -1185 (-8.47%)
scx_layered.bpf.o layered_dispatch 27600 13925 -13675 (-49.55%)
Total progs: 305
Old success: 292
New success: 292
total_insns diff min: -49.55%
total_insns diff max: 0.00%
0 -> value: 0
value -> 0: 0
total_insns abs max old: 257,545
total_insns abs max new: 243,678
-50 .. -45 %: 7
-30 .. -20 %: 5
-20 .. -10 %: 14
-10 .. 0 %: 18
0 .. 5 %: 261
There is also a significant verifier performance improvement for some
bpf_loop() heavy Meta internal programs (~ -40% processed instructions).
---
Eduard Zingerman (2):
bpf: allow states pruning for misc/invalid slots in iterator loops
selftests/bpf: iterator based loop and STACK_MISC states pruning
kernel/bpf/verifier.c | 10 ++---
tools/testing/selftests/bpf/progs/iters.c | 65 +++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 6 deletions(-)
---
base-commit: ccaa6d2c9635a8db06a494d67ef123b56b967a78
change-id: 20251230-loop-stack-misc-pruning-18b1ac62ae1a
next reply other threads:[~2025-12-31 5:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-31 5:36 Eduard Zingerman [this message]
2025-12-31 5:36 ` [PATCH bpf-next 1/2] bpf: allow states pruning for misc/invalid slots in iterator loops Eduard Zingerman
2025-12-31 5:36 ` [PATCH bpf-next 2/2] selftests/bpf: iterator based loop and STACK_MISC states pruning Eduard Zingerman
2025-12-31 17:10 ` [PATCH bpf-next 0/2] bpf: unify state pruning handling of invalid/misc stack slots patchwork-bot+netdevbpf
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=20251230-loop-stack-misc-pruning-v1-0-585cfd6cec51@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--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