Re: [PATCH bpf-next v2] libbpf: Load btf_vmlinux only once per object.

From: Andrii Nakryiko
Date: Fri Jan 17 2020 - 16:55:22 EST


On Fri, Jan 17, 2020 at 1:28 PM KP Singh <kpsingh@xxxxxxxxxxxx> wrote:
>
> From: KP Singh <kpsingh@xxxxxxxxxx>
>
> As more programs (TRACING, STRUCT_OPS, and upcoming LSM) use vmlinux
> BTF information, loading the BTF vmlinux information for every program
> in an object is sub-optimal. The fix was originally proposed in:
>
> https://lore.kernel.org/bpf/CAEf4BzZodr3LKJuM7QwD38BiEH02Cc1UbtnGpVkCJ00Mf+V_Qg@xxxxxxxxxxxxxx/
>
> The btf_vmlinux is populated in the object if any of the programs in
> the object requires it just before the programs are loaded and freed
> after the programs finish loading.
>
> Reported-by: Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx>
> Reviewed-by: Brendan Jackman <jackmanb@xxxxxxxxxxxx>
> Signed-off-by: KP Singh <kpsingh@xxxxxxxxxx>
> ---

Looks great!

Acked-by: Andrii Nakryiko <andriin@xxxxxx>

> tools/lib/bpf/libbpf.c | 153 +++++++++++++++++++++++++++--------------
> 1 file changed, 101 insertions(+), 52 deletions(-)
>

[...]