Re: [PATCH v6 0/9] perf symbol: Sorted arrays, DSO-owned lifetimes, and memory shrinking

From: Namhyung Kim

Date: Thu Nov 19 2026 - 23:33:19 EST


On Thu, Nov 19, 2026 at 08:31:48AM -0800, Ian Rogers wrote:
> On Wed, Nov 18, 2026 at 11:34 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > 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!
>
> Thanks Namhyung! Should I rebase or do anything else for the next 6 patches?

Please read my comments in the thread. :)

Thanks,
Namhyung