From: Alan Maguire <alan.maguire@oracle.com>
To: wanjay@amazon.com
Cc: abuehaze@amazon.com, acme@kernel.org, alan.maguire@oracle.com,
andrii@kernel.org, arighi@nvidia.com, arnd@arndb.de,
ast@kernel.org, bentiss@kernel.org, bpf@vger.kernel.org,
changwoo@igalia.com, christian@heusel.eu, daniel@iogearbox.net,
doebel@amazon.de, eddyz87@gmail.com, ihor.solodrai@linux.dev,
irogers@google.com, jay.wang.upstream@gmail.com,
jikos@kernel.org, jolsa@kernel.org, linux-doc@vger.kernel.org,
linux-input@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-modules@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, linux@weissschuh.net,
martin.lau@linux.dev, mathieu.desnoyers@efficios.com,
mcgrof@kernel.org, memxor@gmail.com, mhiramat@kernel.org,
mpohlack@amazon.de, namhyung@kernel.org, nathan@kernel.org,
nsc@kernel.org, ojeda@kernel.org, petr.pavlu@suse.com,
qmo@kernel.org, rostedt@goodmis.org,
rust-for-linux@vger.kernel.org, samitolvanen@google.com,
sched-ext@lists.linux.dev, shuah@kernel.org, tj@kernel.org,
void@manifault.com, yonghong.song@linux.dev
Subject: Re: [PATCH bpf-next v4 00/12] bpf: make the vmlinux BTF an on-demand loadable module (CONFIG_DEBUG_INFO_BTF=m) to save ~5.4 MB memory
Date: Fri, 2 Oct 2026 11:05:03 +0100 [thread overview]
Message-ID: <88bc8156-efa8-4ea6-aa4c-237323d248ae@oracle.com> (raw)
In-Reply-To: <20261002073422.14253-1-wanjay@amazon.com>
>> A question I had: is it really worth 2k of complicated kernel code to
>> *maybe sometimes* save <10Mb of memory?
>
> There are many reasons this is worth it. The main ones:
>
> 1. This did not start from a number we picked, but from a real use
> case: users who run large fleets of small instances, 1 GiB of
> memory or less, with their workloads sized to fit. We are not able
> to disclose more detail, but for them 5.4 MB on every instance is
> real money, and it can be exactly what pushes a workload over its
> memory budget and onto the next instance size. That is why we took
> this on, even though we knew it would not be a small change.
>
> 2. Loading code and data only when a system needs them is what kernel
> modules exist for. And most of them take well under ~1 MB once
> loaded (nf_conntrack, overlay, vfat); even big ones like ext4, kvm
> and btrfs stay around 1-2.5 MB. The vmlinux BTF is 5.4 MB.
>
> 3. We are not alone in trying to keep BTF out of memory until it is
> needed. The inline BTF work [1] plans to deliver its data, which
> is even larger, through a module too. The .BTF.link record and the
> resolve_btfids option that serve both are already part of this
> series (patch 10), so this is not machinery for the vmlinux BTF
> alone.
The other consideration that embedded folks have raised is disk footprint;
apparently by moving vmlinux .BTF to a module that is a win for them due
to the way embedded systems are partitioned (vmlinux image on a different
partition from modules). And for them a lower memory footprint is a win too.
So from my perspective it is worth doing, especially if the only other option is
to switch BTF off and lose most BPF functionality. Between small VMs
and embedded systems that could amount to a lot of systems.
However it may make sense to approach via a multi-phase delivery. The inline
stuff is pretty close, so if I can land that with the resolve_btfids support
for --btf_link that reduces the footprint of this work somewhat. Then perhaps
it might make sense to split into a prerequisite series that does the prep work
for module-delivered BTF (roughly patches 1-5), avoiding issues around module
load by reorganizing when we access vmlinux BTF. Then the remainder - stuff
which is tied more closely to module vmlinux BTF delivery - would be a smaller
series (I'm planning on sending out the inline kbuild stuff later today all
going well). Others may have different suggestions, but that may make the work
easier to land; the multi-series approach definitely helped with the inline work
FWIW.
Alan
prev parent reply other threads:[~2026-10-02 10:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 22:52 Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 01/12] bpf: pass the vmlinux BTF to btf_parse_module() and let it adopt the data Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 02/12] bpf: split the kfunc, dtor kfunc and struct_ops registration bodies Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 03/12] bpf: fetch the vmlinux BTF where kernel types enter a program Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 04/12] bpf: take the vmlinux BTF from the btf_vmlinux module Jay Wang
2026-10-01 23:45 ` bot+bpf-ci
2026-10-02 11:48 ` Alexei Starovoitov
2026-10-01 22:52 ` [PATCH bpf-next v4 05/12] bpf, tracing: load the vmlinux BTF where tracefs and bpffs requests start Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 06/12] bpf: defer vmlinux kfunc and struct_ops registrations Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 07/12] bpf: keep module BTF until the vmlinux BTF is available Jay Wang
2026-10-01 23:45 ` bot+bpf-ci
2026-10-01 22:52 ` [PATCH bpf-next v4 08/12] bpf: expose deferred .BTF.base module BTF in sysfs from module load Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 09/12] bpf, trace, net: prepare CONFIG_DEBUG_INFO_BTF checks for a tristate Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 10/12] resolve_btfids: add --btf_link to fill in .BTF.link records Jay Wang
2026-10-01 23:29 ` bot+bpf-ci
2026-10-01 22:52 ` [PATCH bpf-next v4 11/12] tools, samples: take the vmlinux BTF from vmlinux.unstripped first Jay Wang
2026-10-01 22:52 ` [PATCH bpf-next v4 12/12] kbuild, bpf: allow building the vmlinux BTF as a module Jay Wang
2026-10-02 9:47 ` Alan Maguire
2026-10-02 4:36 ` [PATCH bpf-next v4 00/12] bpf: make the vmlinux BTF an on-demand loadable module (CONFIG_DEBUG_INFO_BTF=m) to save ~5.4 MB memory Ihor Solodrai
2026-10-02 7:34 ` Jay Wang
2026-10-02 10:05 ` Alan Maguire [this message]
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=88bc8156-efa8-4ea6-aa4c-237323d248ae@oracle.com \
--to=alan.maguire@oracle.com \
--cc=abuehaze@amazon.com \
--cc=acme@kernel.org \
--cc=andrii@kernel.org \
--cc=arighi@nvidia.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=bentiss@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=changwoo@igalia.com \
--cc=christian@heusel.eu \
--cc=daniel@iogearbox.net \
--cc=doebel@amazon.de \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=irogers@google.com \
--cc=jay.wang.upstream@gmail.com \
--cc=jikos@kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mcgrof@kernel.org \
--cc=memxor@gmail.com \
--cc=mhiramat@kernel.org \
--cc=mpohlack@amazon.de \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=qmo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--cc=sched-ext@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--cc=wanjay@amazon.com \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®