Re: [PATCH v8 00/10] perf symbol: Sorted arrays, DSO-owned lifetimes, and memory shrinking
From: Ian Rogers
Date: Mon Nov 23 2026 - 22:27:30 EST
On Mon, Nov 23, 2026 at 4:31 PM Alireza Haghdoost <haghdoost@xxxxxxxx> wrote:
>
> Hi Ian, Namhyung,
>
> > >
> > > I've applied the first 6 patches to perf-tools-next.
> > >
> > > The patch 7 was bigger than I expected. Can you simplify it more?
> > >
> > > Also I don't plan to merge the rest patches as of now. Let's wait for
> > > the lazy loading and try that for a while.
> >
> > Thanks for merging those ones. I will split patch 7 and rebase. Patch
> > 8, shrinking DSOs, etc. is kind of the whole point of the series.
> >
> > Thanks,
> > Ian
> >
>
> The lazy loading v9 is rebased onto perf-tools-next with the first six
> patches, so it now works on the sorted symbol array instead of the
> rb-tree. I'm going through review fixes and should post it later this
> week.
>
> Ian, it uses symbols__visit(), symbols__sort_read_lock() and the
> symbols array directly, so if the split of patch 7 changes those, I'll
> rebase on whichever lands first. I'm also happy to run your remaining
> patches on top of v9 against the same profile as in the cover letter
> and send the numbers, since the two should save memory in different
> places.
Thanks! In v9 (sending out shortly), symbols__visit() and
symbols__sort_read_lock() keep the same signatures and contract:
symbols__sort_read_lock() merges any secondary sorted run or unsorted
tail so symbols->symbols[0 .. symbols->cnt) is a single contiguous
sorted array under the read lock.
The only struct symbols field change to watch for if lazy loading
populates struct symbols directly (rather than via symbols__insert())
is that num_by_name, sorted_by_name, and the sorted boolean were
dropped in favor of sorted_cnt and sorted_tail_cnt (so sorted = true
becomes sorted_cnt = cnt; sorted_tail_cnt = 0, and zfree(&symbols_by_name)
alone invalidates the name index).
Running the shrinking patches on top of lazy loading v9 against your
profile sounds great—thank you for offering to test and share the
numbers!
Thanks,
Ian
> Thanks,
> Alireza