Re: [PATCH v4 03/19] perf/uapi: Add BUILD_ID_OFFSET sample types to UAPI
From: Peter Zijlstra
Date: Wed Dec 02 2026 - 07:44:05 EST
On Tue, Dec 01, 2026 at 09:10:49AM -0800, Ian Rogers wrote:
> 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.
Just make them fatal :-)
> - 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.
It seems perf doesn't even use procmap_query. But that would also
suggest maybe extending procmap_query to query multiple/other pids. This
would then immediately avoid having to allocate all those inodes.
It also helps with latencies, since procmap_query doesn't lean quite so
hard an mmap_lock, instead relying more on vma_lock (iiuc).
I'm not sure there's something to be done about the volume of data
though. Limiting scope and perhaps a better on-disk format might help --
that is, do a string table for perf.data and have build_id[] and
filename[] deduplicated or something. Also, sample_id contains redundant
information, that could easily be 'fixed'.
I hear this AI thing is good at finding patterns, perhaps you can use it
to develop an efficient online compressor for this crud.