[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <76e2860403e1bed66f76688132ffe71316f28445.camel@gmail.com>
Date: Mon, 20 Oct 2025 18:06:16 -0700
From: Eduard Zingerman <eddyz87@...il.com>
To: Donglin Peng <dolinux.peng@...il.com>, ast@...nel.org
Cc: linux-kernel@...r.kernel.org, bpf@...r.kernel.org, Andrii Nakryiko
<andrii.nakryiko@...il.com>, Alan Maguire <alan.maguire@...cle.com>, Song
Liu <song@...nel.org>, pengdonglin <pengdonglin@...omi.com>
Subject: Re: [RFC PATCH v2 1/5] btf: search local BTF before base BTF
On Mon, 2025-10-20 at 17:39 +0800, Donglin Peng wrote:
> Change btf_find_by_name_kind() to search the local BTF first,
> then fall back to the base BTF. This can skip traversing the large
> vmlinux BTF when the target type resides in a kernel module's BTF,
> thereby significantly improving lookup performance.
>
> In a test searching for the btf_type of function ext2_new_inode
> located in the ext2 kernel module:
>
> Before: 408631 ns
> After: 499 ns
>
> Performance improvement: ~819x faster
[...]
> ---
The flip makes sense, but are we sure that there are no implicit
expectations to return base type in case of a name conflict?
E.g. kernel/bpf/btf.c:btf_parse_struct_metas() takes a pointer to
`btf` instance and looks for types in alloc_obj_fields array by name
(e.g. "bpf_spin_lock"). This will get confused if module declares a
type with the same name. Probably not a problem in this particular
case, but did you inspect other uses?
Powered by blists - more mailing lists