Re: [PATCH v6 0/9] perf symbol: Sorted arrays, DSO-owned lifetimes, and memory shrinking
From: Namhyung Kim
Date: Thu Nov 19 2026 - 02:34:29 EST
On Tue, Nov 17, 2026 at 10:52:56AM -0800, Ian Rogers wrote:
> When profiling large binaries or long-running workloads with many DSOs and
> threads, symbol and DSO tables frequently dominate perf's memory footprint
> and startup latency. Currently `struct symbol` has several structural
> limitations:
>
> 1. Every `struct symbol` embeds a 24-byte `struct rb_node` for the
> `dso->symbols` address rbtree, plus an optional negative-offset
> allocation prefix (`symbol_conf.priv_size`) for `struct annotation`
> state even when only a tiny fraction of symbols are ever annotated.
> 2. `dso__symbols()` has no internal synchronization against concurrent
> readers/writers, and `struct call_path` (plus Python callchain frames
> and nodes) still retains raw `struct symbol *` pointers without
> retaining a reference on the owning `struct dso`, preventing
> unreferenced DSOs and their symbol tables from being safely reclaimed
> under memory pressure.
> 3. ELF symbol table loading (`dso__load_sym_internal()`) repeatedly
> invokes `libelf` section/program header lookups per symbol, calls
> `elf_sym__name()` before filtering out non-function/non-allocated
> symbols, and resorts `dso->symbols` with `qsort()` even when ELF symbol
> tables are already largely ordered in ascending address runs.
[...]
Applied the first 3 patches to perf-tools-next, thanks!
Best regards
Namhyung