Re: [PATCH v4 03/19] perf/uapi: Add BUILD_ID_OFFSET sample types to UAPI

From: Peter Zijlstra

Date: Wed Dec 02 2026 - 05:33:50 EST


On Tue, Dec 01, 2026 at 09:10:49AM -0800, Ian Rogers wrote:

> > > Which aspect is the main objection here -- the 8-bit/56-bit packing,
> > > the per-sample deduplication in the kernel, or repeating build IDs per
> > > sample instead of a sideband mapping?
> >
> > Like I just replied; I don't see why we need it at all; we already have
> > buildid in the mmap sideband data. That is sufficient to reconstruct at
> > post processing.
>
> The point of having build ID + offset in samples is to avoid needing
> MMAP2 sideband and /proc synthesis altogether -- with a symbol server /
> debuginfod, samples carry everything needed to symbolize without
> tracking every process's address space.
>
> Relying on MMAP2 sideband only gives new mappings; for system-wide
> profiling, perf still has to crawl /proc/<pid>/maps for every existing
> task at startup and record every subsequent mmap/fork across the
> machine, even for processes that are never sampled. On large
> consolidated servers that overhead is substantial:
>
> - For infrequent system-wide events (e.g. bus lock), synthesizing and
> recording all system-wide mmaps dwarfs the cost and size of the
> actual samples.
> - Even for high-frequency events like cycles, on a large server with
> lots of consolidated work we see over half of perf.data consisting of
> mmap events, and that share keeps growing as more work (including
> guest VMs / containers) is consolidated onto larger machines.
> - On a loaded machine, just allocating the procfs inodes to scan
> /proc/<pid>/maps at perf startup can trigger memory reclaim and
> latency spikes -- worst when you are profiling a machine because it
> is already under stress.
>
> So build ID + offset samples make sense today for infrequent
> system-wide events (like bus lock) and for profiling machines under
> stress without an upfront synthesis storm (reusing the kernel's
> existing stack_map_get_build_id_offset() helper via defer_callchain).
>
> Longer term, for general profiling this also lets us optimize sideband
> overhead by running two events -- one with build ID + offset and one
> with raw virtual addresses -- starting with build-ID samples while
> lazily synthesizing mappings in the background, then switching over to
> compact virtual-address samples once mappings are ready.
>
> Given those use cases, is your objection specifically to the packed
> table encoding in v4 (where a simpler UAPI layout could work), or to
> having build-ID + offset samples in perf at all?

Bah. So realistically buildid *never* changes vs the frequency of
samples. Adding buildid into samples is utterly insane from that
perspective.

Additionally, the whole buildid thing is an utter shitshow when trying
to do it from sample context.

So I really don't want buildid from sample context. It doesn't make
sense on so many levels.

I would much rather invest in better means of doing that initial setup.
Eg. would it help to have UNMAP events for executable mappings (that
contain the buildid of what was)?