linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Donglin Peng <dolinux.peng@gmail.com>
Cc: ast@kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org,  Eduard Zingerman <eddyz87@gmail.com>,
	Alan Maguire <alan.maguire@oracle.com>,
	Song Liu <song@kernel.org>,  pengdonglin <pengdonglin@xiaomi.com>
Subject: Re: [RFC PATCH v3 3/3] btf: Reuse libbpf code for BTF type sorting verification and binary search
Date: Tue, 28 Oct 2025 11:40:03 -0700	[thread overview]
Message-ID: <CAEf4BzZ+tpT2ViD_zc8mwz260spriYDiPymw3MFsEibRcuqbqg@mail.gmail.com> (raw)
In-Reply-To: <20251027135423.3098490-4-dolinux.peng@gmail.com>

On Mon, Oct 27, 2025 at 6:54 AM Donglin Peng <dolinux.peng@gmail.com> wrote:
>
> The previous commit implemented BTF sorting verification and binary
> search algorithm in libbpf. This patch enables this functionality in
> the kernel.
>
> Cc: Eduard Zingerman <eddyz87@gmail.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
> Cc: Alan Maguire <alan.maguire@oracle.com>
> Cc: Song Liu <song@kernel.org>
> Signed-off-by: pengdonglin <pengdonglin@xiaomi.com>
> Signed-off-by: Donglin Peng <dolinux.peng@gmail.com>
> ---
> v2->v3:
> - Include btf_sort.c directly in btf.c to reduce function call overhead
> ---
>  kernel/bpf/btf.c | 34 ++++++++++++++++++----------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 0de8fc8a0e0b..df258815a6ca 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -33,6 +33,7 @@
>  #include <net/sock.h>
>  #include <net/xdp.h>
>  #include "../tools/lib/bpf/relo_core.h"
> +#include "../tools/lib/bpf/btf_sort.h"

I don't believe in code reuse for the sake of code reuse. This code
sharing just makes everything more entangled and complicated.
Reimplementing binary search is totally fine, IMO.

[...]

  parent reply	other threads:[~2025-10-28 18:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 13:54 [RFC PATCH v3 0/3] Significantly Improve BTF Type Lookup Performance Donglin Peng
2025-10-27 13:54 ` [RFC PATCH v3 1/3] btf: implement BTF type sorting for accelerated lookups Donglin Peng
2025-10-27 14:20   ` bot+bpf-ci
2025-10-27 18:40   ` Eduard Zingerman
2025-10-28  2:15     ` Donglin Peng
2025-10-27 19:06   ` Eduard Zingerman
2025-10-28  2:18     ` Donglin Peng
2025-10-28 18:15     ` Andrii Nakryiko
2025-10-28 18:38   ` Andrii Nakryiko
2025-10-29  5:04     ` Donglin Peng
2025-10-27 13:54 ` [RFC PATCH v3 2/3] selftests/bpf: add tests for BTF type permutation Donglin Peng
2025-10-27 18:53   ` Eduard Zingerman
2025-10-28  2:23     ` Donglin Peng
2025-10-27 13:54 ` [RFC PATCH v3 3/3] btf: Reuse libbpf code for BTF type sorting verification and binary search Donglin Peng
2025-10-27 19:55   ` Alexei Starovoitov
2025-10-29  1:57     ` Donglin Peng
2025-10-28 18:40   ` Andrii Nakryiko [this message]
2025-10-29  2:03     ` Donglin Peng

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=CAEf4BzZ+tpT2ViD_zc8mwz260spriYDiPymw3MFsEibRcuqbqg@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=alan.maguire@oracle.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dolinux.peng@gmail.com \
    --cc=eddyz87@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pengdonglin@xiaomi.com \
    --cc=song@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).