]> git.ipfire.org Git - thirdparty/linux.git/commit
libbpf: Optimize type lookup with binary search for sorted BTF
authorDonglin Peng <pengdonglin@xiaomi.com>
Fri, 9 Jan 2026 12:59:56 +0000 (20:59 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 14 Jan 2026 00:16:58 +0000 (16:16 -0800)
commitd836e5e64992363b5fa9b121f1ab4a1a1b89162d
treec96f26d7f31bdec9da35a5752761751d720ed085
parent230e7d7de5a8d2bcda2a5cdcc8c176c09a63e331
libbpf: Optimize type lookup with binary search for sorted BTF

This patch introduces binary search optimization for BTF type lookups
when the BTF instance contains sorted types.

The optimization significantly improves performance when searching for
types in large BTF instances with sorted types. For unsorted BTF, the
implementation falls back to the original linear search.

Signed-off-by: Donglin Peng <pengdonglin@xiaomi.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260109130003.3313716-5-dolinux.peng@gmail.com
tools/lib/bpf/btf.c