Re: [RFC PATCH v3 3/3] btf: Reuse libbpf code for BTF type sorting verification and binary search

From: Donglin Peng

Date: Tue Oct 28 2025 - 21:57:28 EST


On Tue, Oct 28, 2025 at 3:56 AM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> On Mon, Oct 27, 2025 at 6:54 AM Donglin Peng <dolinux.peng@xxxxxxxxx> wrote:
> >
> > +
> > +/*
> > + * btf_sort.c is included directly to avoid function call overhead
> > + * when accessing BTF private data, as this file is shared between
> > + * libbpf and kernel and may be called frequently (especially when
> > + * funcgraph-args or func-args tracing options are enabled).
> > + */
> > +#include "../../tools/lib/bpf/btf_sort.c"
>
> function call overhead? I don't believe it's measurable.

Thank you. Since the overhead is primarily due to the function graph tracer,
I have reverted to the v2 approach and added the notrace attribute to the
relevant functions.

>
> Don't do it on libbpf side either.

Yes.

>
> pw-bot: cr