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

From: Namhyung Kim

Date: Wed Nov 25 2026 - 16:45:39 EST


Hi Peter,

On Wed, Nov 25, 2026 at 02:25:12PM +0100, Peter Zijlstra wrote:
> On Tue, Nov 24, 2026 at 04:50:52PM -0800, Ian Rogers wrote:
> > Introduce PERF_SAMPLE_BUILD_ID_OFFSET and
> > PERF_SAMPLE_CALLCHAIN_BUILD_ID_OFFSET in enum perf_event_sample_format.
> >
> > For PERF_SAMPLE_CALLCHAIN_BUILD_ID_OFFSET (and
> > PERF_RECORD_CALLCHAIN_DEFERRED when PERF_RECORD_MISC_MMAP_BUILD_ID is
> > set), encode a deduplicated table of variable-length build IDs
> > (u32 nr_build_ids, u32 nr_offsets, followed by packed { u8 size;
> > u8 data[size]; } entries padded to 8-byte alignment) and an array of
> > 64-bit offsets whose top 8 bits encode the 1-based build ID index (or
> > 0x00 for unresolved user addresses and 0xff for kernel/context entries).
> > In common cases where multiple callchain frames belong to the same
> > binary, each unique build ID is encoded only once.
>
> Why ?!? This is insane

This is basically to save space for callchains. When multiple entries
fall into the same binary, it can have a table of binaries/build-ids
and use indices instead of repeating full build-id for each entry.

It'd be great if it could have a global (or per-session) table. This is
a per-sample table. Please let us know if you have a better idea.

Thanks,
Namhyung