]> git.ipfire.org Git - thirdparty/linux.git/commit
bpf: Skip anonymous types in type lookup for performance
authorDonglin Peng <pengdonglin@xiaomi.com>
Fri, 9 Jan 2026 13:00:00 +0000 (21:00 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 14 Jan 2026 00:21:36 +0000 (16:21 -0800)
commitdc893cfa390aa9d5fc83c908ea5e37a36e531892
tree8519155a3a06fa6d406c2475e0970c6fb0def5bb
parent342bf525ba0d83374f318e19186d50b1e7160d0e
bpf: Skip anonymous types in type lookup for performance

Currently, vmlinux and kernel module BTFs are unconditionally
sorted during the build phase, with named types placed at the
end. Thus, anonymous types should be skipped when starting the
search. In my vmlinux BTF, the number of anonymous types is
61,747, which means the loop count can be reduced by 61,747.

Signed-off-by: Donglin Peng <pengdonglin@xiaomi.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/bpf/20260109130003.3313716-9-dolinux.peng@gmail.com
kernel/bpf/btf.c
kernel/bpf/verifier.c