From: David Laight <david.laight.linux@gmail.com>
To: Ian Rogers <irogers@google.com>
Cc: Alireza Haghdoost <haghdoost@uber.com>,
acme@kernel.org, namhyung@kernel.org, adrian.hunter@intel.com,
james.clark@linaro.org, jolsa@kernel.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
mingo@redhat.com, peterz@infradead.org
Subject: Re: [PATCH v2 00/18] perf symbol: Reference counting, sorted arrays, and memory shrinking
Date: Sat, 31 Oct 2026 17:22:29 +0000 [thread overview]
Message-ID: <20261031172229.0d178d73@pumpkin> (raw)
In-Reply-To: <CAP-5=fUJy=fZg3t0z7L=uKVVRjg8OQtCL3KxFR8Mrv-yVCtuzA@mail.gmail.com>
On Fri, 30 Oct 2026 10:57:27 -0700
Ian Rogers <irogers@google.com> wrote:
> To: Alireza Haghdoost <haghdoost@uber.com>
> Cc: acme@kernel.org, namhyung@kernel.org, adrian.hunter@intel.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org
> Subject: Re: [PATCH v2 00/18] perf symbol: Reference counting, sorted arrays, and memory shrinking
> Date: Fri, 30 Oct 2026 10:57:27 -0700
>
> On Fri, Oct 30, 2026 at 9:10 AM Ian Rogers <irogers@google.com> wrote:
> >
> > On Fri, Oct 30, 2026 at 7:02 AM Alireza Haghdoost <haghdoost@uber.com> wrote:
> > >
> > > Hi Ian,
> > >
> > > I applied v2 on perf-tools-next e74880764bf9 with the ELF_C_READ_MMAP
> > > fix and your three fixes, and compared it with the same tree without
> > > the 18 patches. I posted comments are on the individual patches; this is the
> > > summary.
> > >
> > > On a profile of a large C++ service, about 1M symbols, perf script and perf r
> > > eport output is byte-identical and roughly 22-32% faster:
> > >
> > > Execution time and peak RSS before and after:
> > > perf script 3.3s 334 MiB vs 2.25s 332 MiB
> > > perf report --sort dso,sym 3.0s 389 MiB vs 2.25s 386 MiB
> > > perf report --children -g caller 4.6s 706 MiB vs 3.60s 703 MiB
> > >
> > > Peak RSS barely moves. sizeof(struct symbol) goes from 48 to 32 bytes,
> > > but the address array adds a pointer per symbol back, so the net is
> > > about 8 bytes per symbol before malloc rounding. That is under 1%
> > > here.
> >
> > Thanks for your work and running the numbers! I think we should aim to
> > land your lazy loading patches ahead of these patches. The merge
> > conflicts don't look like they'll be too terrible, wdyt?
> >
> > Since the merge window for Linux v7.4 is currently open, I don't see
> > anything landing before November 1st. So I can do a v3 incorporating
> > your suggestions and rebase it on top of your patches when they land.
> > I'll work on pulling out the fixes (you highlighted some you thought
> > were particularly worthwhile) to mail for v7.4 for now.
>
> Chatting with Namhyung he mentions having the arrays in the DSOs be a
> `struct symbol[]` rather than a `struct symbol *[]`, because the
> number of symbols could be known for a DSO when we load the symbols.
> Currently this isn't possible because of things like the
> annotated_symbol that this series turns into a side table. I'm not
> sure it is possible in general to use an array of symbols, as JIT code
> may need the symbols array to be realloc-ed and the realloc would
> potentially invalidate any `symbol *` that had been given out. Maybe
> we can treat that as a special case. In this scenario, the symbol's
> lifetime would tie to the DSO's lifetime, allowing us to use the DSO
> reference count instead of needing one per symbol. It would still be
> nice to add functions like session__malloc so that we can reduce the
> memory footprint of a session when memory allocations fail. I still
> think this is work to land on top of your series.
Could you have two tables, one 'struct symbol []' containing the fixed
symbols and a second smaller 'struct symbol *[]' containing any extra
symbols?
Lookup would require checking both tables - but won't cost much more.
David
>
> Thanks,
> Ian
prev parent reply other threads:[~2026-10-31 17:22 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 7:52 [PATCH v1 0/7] perf symbol: Reference counting, flat array storage, and LRU shrinking Ian Rogers
2026-09-28 7:52 ` [PATCH v1 1/7] perf symbol: Add accessor functions for struct symbol fields Ian Rogers
2026-09-28 7:52 ` [PATCH v1 2/7] perf symbol: Remove symbol_conf.priv_size and negative-offset allocations Ian Rogers
2026-09-28 7:52 ` [PATCH v1 3/7] perf symbol: Switch backing storage from rbtree to struct symbols array Ian Rogers
2026-09-28 7:52 ` [PATCH v1 4/7] perf symbol: Add reference counting and DECLARE_RC_STRUCT(symbol) Ian Rogers
2026-09-28 7:52 ` [PATCH v1 5/7] perf symbol: Add LRU memory shrinking for symbols, DSOs, and machines Ian Rogers
2026-09-28 7:52 ` [PATCH v1 6/7] perf session: Periodically shrink symbols and DSOs during event processing Ian Rogers
2026-09-28 7:52 ` [PATCH v1 7/7] perf test symbols: Add tests for symbol and DSO LRU shrinking Ian Rogers
2026-09-28 15:37 ` [PATCH v1 0/7] perf symbol: Reference counting, flat array storage, and " Ian Rogers
2026-09-28 19:45 ` Alireza Haghdoost
2026-09-28 20:55 ` Ian Rogers
2026-09-28 21:51 ` Namhyung Kim
2026-09-28 22:04 ` Ian Rogers
2026-09-29 0:12 ` Alireza Haghdoost
2026-09-29 18:09 ` Namhyung Kim
2026-09-29 21:24 ` Alireza Haghdoost
2026-09-29 18:06 ` Namhyung Kim
2026-10-27 23:14 ` [PATCH v2 00/18] perf symbol: Reference counting, sorted arrays, and memory shrinking Ian Rogers
2026-10-27 23:14 ` [PATCH v2 01/18] perf bench internals: Add symbols and maps benchmarks Ian Rogers
2026-10-29 19:46 ` Alireza Haghdoost
2026-11-01 2:48 ` Namhyung Kim
2026-10-27 23:14 ` [PATCH v2 02/18] perf demangle: Add fast-path prefix checks for Rust and Java demanglers Ian Rogers
2026-10-27 23:14 ` [PATCH v2 03/18] perf symbol: Add accessor functions for struct symbol fields Ian Rogers
2026-10-30 4:08 ` Alireza Haghdoost
2026-10-27 23:14 ` [PATCH v2 04/18] perf map_browser: Compute symbol browser index on demand Ian Rogers
2026-10-27 23:14 ` [PATCH v2 05/18] perf db-export: Store symbol database IDs in a hashmap Ian Rogers
2026-10-27 23:15 ` [PATCH v2 06/18] perf annotate: Move struct annotation to a hashmap and remove symbol_conf.priv_size Ian Rogers
2026-10-30 12:51 ` Alireza Haghdoost
2026-10-27 23:15 ` [PATCH v2 07/18] perf symbol: Switch backing storage from rbtree to struct symbols array Ian Rogers
2026-10-30 13:12 ` Alireza Haghdoost
2026-10-27 23:15 ` [PATCH v2 08/18] perf symbol: Add reference counting and DECLARE_RC_STRUCT(symbol) Ian Rogers
2026-10-30 13:22 ` Alireza Haghdoost
2026-10-27 23:15 ` [PATCH v2 09/18] perf symbol: Optimize symbol sorting with natural-run merge sort and binary insertion Ian Rogers
2026-10-30 13:27 ` Alireza Haghdoost
2026-10-27 23:15 ` [PATCH v2 10/18] perf maps: Optimize tail insertion and small-append sorting Ian Rogers
2026-10-27 23:15 ` [PATCH v2 11/18] perf symbol-elf: Cache ELF program/section headers and defer symbol name lookup Ian Rogers
2026-10-30 13:32 ` Alireza Haghdoost
2026-10-27 23:15 ` [PATCH v2 12/18] perf rwsem: Add down_read_trylock() and down_write_trylock() Ian Rogers
2026-10-30 13:39 ` Alireza Haghdoost
2026-10-27 23:15 ` [PATCH v2 13/18] perf vdso: Constify dso parameter in dso__is_vdso() Ian Rogers
2026-10-27 23:15 ` [PATCH v2 14/18] perf machine: Protect machines->guests rbtree with a rw_semaphore Ian Rogers
2026-10-27 23:15 ` [PATCH v2 15/18] perf symbol: Add memory shrinking for symbols, DSOs, and machines Ian Rogers
2026-10-30 13:53 ` Alireza Haghdoost
2026-10-27 23:15 ` [PATCH v2 16/18] perf session: Add dso__session() and session-scoped allocation wrappers Ian Rogers
2026-10-27 23:15 ` [PATCH v2 17/18] perf symbol: Use session allocation wrappers in symbol, DSO, thread, and hist paths Ian Rogers
2026-10-27 23:15 ` [PATCH v2 18/18] perf test symbols: Add tests for symbol shrinking and session alloc wrappers Ian Rogers
2026-10-30 13:55 ` Alireza Haghdoost
2026-10-28 20:29 ` [PATCH v2 00/18] perf symbol: Reference counting, sorted arrays, and memory shrinking Ian Rogers
2026-10-30 14:02 ` Alireza Haghdoost
2026-10-30 16:10 ` Ian Rogers
2026-10-30 17:57 ` Ian Rogers
2026-10-31 17:22 ` David Laight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261031172229.0d178d73@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=haghdoost@uber.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®