linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] Allow mmap of /sys/kernel/btf/vmlinux
@ 2025-05-01 14:28 Lorenz Bauer
  2025-05-01 14:28 ` [PATCH bpf-next 1/2] btf: allow mmap of vmlinux btf Lorenz Bauer
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lorenz Bauer @ 2025-05-01 14:28 UTC (permalink / raw)
  To: Arnd Bergmann, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Mykola Lysenko, Shuah Khan
  Cc: linux-arch, linux-kernel, bpf, linux-kselftest, Lorenz Bauer

I'd like to cut down the memory usage of parsing vmlinux BTF in ebpf-go.
With some upcoming changes the library is sitting at 5MiB for a parse.
Most of that memory is simply copying the BTF blob into user space.
By allowing vmlinux BTF to be mmapped read-only into user space I can
cut memory usage by about 75%.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
---
Lorenz Bauer (2):
      btf: allow mmap of vmlinux btf
      selftests: bpf: add a test for mmapable vmlinux BTF

 include/asm-generic/vmlinux.lds.h                  |  3 +-
 kernel/bpf/sysfs_btf.c                             | 25 ++++++-
 tools/testing/selftests/bpf/prog_tests/btf_sysfs.c | 79 ++++++++++++++++++++++
 3 files changed, 104 insertions(+), 3 deletions(-)
---
base-commit: 38d976c32d85ef12dcd2b8a231196f7049548477
change-id: 20250501-vmlinux-mmap-2ec5563c3ef1

Best regards,
-- 
Lorenz Bauer <lmb@isovalent.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-05-02 10:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-01 14:28 [PATCH bpf-next 0/2] Allow mmap of /sys/kernel/btf/vmlinux Lorenz Bauer
2025-05-01 14:28 ` [PATCH bpf-next 1/2] btf: allow mmap of vmlinux btf Lorenz Bauer
2025-05-01 20:26   ` Alexei Starovoitov
2025-05-02 10:19     ` Lorenz Bauer
2025-05-01 14:28 ` [PATCH bpf-next 2/2] selftests: bpf: add a test for mmapable vmlinux BTF Lorenz Bauer
2025-05-01 15:58 ` [PATCH bpf-next 0/2] Allow mmap of /sys/kernel/btf/vmlinux Daniel Xu

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).