From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: acme@kernel.org, haghdoost@uber.com, 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 v4 11/23] perf annotate: Move struct annotation to a hashmap and remove symbol_conf.priv_size
Date: Sat, 14 Nov 2026 20:06:00 -0800 [thread overview]
Message-ID: <avkvqOTFLHODjjrr@z2> (raw)
In-Reply-To: <20261113171734.2188066-12-irogers@google.com>
On Fri, Nov 13, 2026 at 09:17:22AM -0800, Ian Rogers wrote:
> Previously, enabling annotation added sizeof(struct annotation) to
> symbol_conf.priv_size, bloating every loaded struct symbol in every DSO
> even though only a small fraction of symbols are ever annotated.
>
> Move struct annotation storage to an on-demand hashmap in
> util/annotate.c keyed by struct symbol pointer, guarded by
> annotations_lock and tracked via a new SYMBOL_FLAG_ANNOTATED flag in
> sym->flags so unannotated symbols pay zero lookup or teardown overhead.
> If allocation fails in symbol__annotation(), return a static
> empty_annotation fallback so callers that do not check for NULL remain
> safe while mutating callers check for &empty_annotation.
>
> With annotation, TUI map browser indices, and db-export symbol IDs no
> longer using negative-offset space ahead of struct symbol, remove
> symbol_conf.priv_size and symbol__priv().
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
[SNIP]
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 6347bd218ad5..a0ad62e452be 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -78,9 +78,9 @@ enum symbol_idle_kind {
> #define SYMBOL_FLAG_INLINED (1 << 11)
> #define SYMBOL_FLAG_ANNOTATE2 (1 << 12)
> #define SYMBOL_FLAG_IFUNC_ALIAS (1 << 13)
> +#define SYMBOL_FLAG_ANNOTATED (1 << 14)
Do we really need this? I think we can just check the hash table
without adding the flag. Of course it requires a read lock, but
it'll be needed anyway, right?
Thanks,
Namhyung
> /**
> - * A symtab entry. When allocated this may be preceded by an annotation (see
> - * symbol__annotation) and/or a browser_index (see symbol__browser_index).
> + * A symtab entry.
> */
> struct symbol {
> struct rb_node rb_node;
> @@ -135,12 +135,19 @@ static inline bool symbol__ifunc_alias(const struct symbol *sym)
> SYMBOL_FLAG_IFUNC_ALIAS) != 0;
> }
>
> +static inline bool symbol__annotated(const struct symbol *sym)
> +{
> + return (atomic_load_explicit(&sym->flags, memory_order_relaxed) &
> + SYMBOL_FLAG_ANNOTATED) != 0;
> +}
> +
> bool symbol__is_idle(struct symbol *sym, const struct dso *dso, struct perf_env *env);
>
> void symbol__set_ignore(struct symbol *sym, bool ignore);
> void symbol__set_annotate2(struct symbol *sym, bool annotate2);
> void symbol__set_inlined(struct symbol *sym, bool inlined);
> void symbol__set_ifunc_alias(struct symbol *sym, bool ifunc_alias);
> +void symbol__set_annotated(struct symbol *sym, bool annotated);
>
> /* symbols__for_each_entry - iterate over symbols (rb_root)
> *
next prev parent reply other threads:[~2026-11-15 4:06 UTC|newest]
Thread overview: 144+ 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
2026-11-10 22:07 ` [PATCH v3 00/20] perf symbol: Sorted arrays, DSO-owned lifetimes, " Ian Rogers
2026-11-10 22:07 ` [PATCH v3 01/20] perf map_browser: Fix browser index heap corruption by computing on demand Ian Rogers
2026-11-10 22:20 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 02/20] perf machine: Protect machines->guests rbtree with a rw_semaphore Ian Rogers
2026-11-10 22:22 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 03/20] perf vdso: Constify dso parameter in dso__is_vdso() Ian Rogers
2026-11-10 22:14 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 04/20] perf rwsem: Add down_read_trylock() and down_write_trylock() Ian Rogers
2026-11-10 22:33 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 05/20] perf map_symbol: Add struct dso_symbol and use for parent symbols Ian Rogers
2026-11-10 22:24 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 06/20] perf call-path: Use struct dso_symbol to retain symbol DSO lifetimes Ian Rogers
2026-11-10 22:20 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 07/20] perf db-export: Store symbol database IDs in a hashmap Ian Rogers
2026-11-10 22:25 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 08/20] perf annotate: Move struct annotation to a hashmap and remove symbol_conf.priv_size Ian Rogers
2026-11-10 22:26 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 09/20] perf bench internals: Add symbols benchmark Ian Rogers
2026-11-10 22:21 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 10/20] perf bench internals: Add maps benchmark Ian Rogers
2026-11-10 22:24 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 11/20] perf demangle: Add fast-path prefix checks for Rust and Java demanglers Ian Rogers
2026-11-10 22:23 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 12/20] perf symbol-elf: Cache ELF program/section headers and defer symbol name lookup Ian Rogers
2026-11-10 22:25 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 13/20] perf maps: Optimize tail insertion and small-append sorting Ian Rogers
2026-11-10 22:37 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 14/20] perf symbol: Add accessor functions for struct symbol fields Ian Rogers
2026-11-10 22:36 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 15/20] perf symbol: Switch backing storage from rbtree to struct symbols array Ian Rogers
2026-11-10 22:41 ` sashiko-bot
2026-11-10 22:07 ` [PATCH v3 16/20] perf symbol: Optimize symbol sorting with natural-run merge sort and binary insertion Ian Rogers
2026-11-10 22:34 ` sashiko-bot
2026-11-10 22:08 ` [PATCH v3 17/20] perf symbol: Add memory shrinking for symbols, DSOs, and machines Ian Rogers
2026-11-10 22:46 ` sashiko-bot
2026-11-10 22:08 ` [PATCH v3 18/20] perf session: Add dso__session() and session-scoped allocation wrappers Ian Rogers
2026-11-10 22:46 ` sashiko-bot
2026-11-10 22:08 ` [PATCH v3 19/20] perf symbol: Use session allocation wrappers in symbol, DSO, thread, and hist paths Ian Rogers
2026-11-10 22:55 ` sashiko-bot
2026-11-10 22:08 ` [PATCH v3 20/20] perf test symbols: Add tests for symbol shrinking and session alloc wrappers Ian Rogers
2026-11-10 22:44 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 00/23] perf symbol: Sorted arrays, DSO-owned lifetimes, and memory shrinking Ian Rogers
2026-11-13 17:17 ` [PATCH v4 01/23] perf machine: Fix NULL deref on allocation failure in __machine__findnew_thread() Ian Rogers
2026-11-13 17:26 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 02/23] perf threads: Avoid table->lock self-deadlock in threads__for_each_thread() Ian Rogers
2026-11-13 17:30 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 03/23] perf tools: Remove perf_singlethreaded Ian Rogers
2026-11-13 17:41 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 04/23] perf map_browser: Fix browser index heap corruption by computing on demand Ian Rogers
2026-11-13 17:31 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 05/23] perf machine: Protect machines->guests rbtree with a rw_semaphore Ian Rogers
2026-11-13 17:33 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 06/23] perf vdso: Constify dso parameter in dso__is_vdso() Ian Rogers
2026-11-13 17:26 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 07/23] perf rwsem: Add down_read_trylock() and down_write_trylock() Ian Rogers
2026-11-13 17:27 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 08/23] perf map_symbol: Add struct dso_symbol and use for parent symbols Ian Rogers
2026-11-13 17:33 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 09/23] perf call-path: Use struct dso_symbol to retain symbol DSO lifetimes Ian Rogers
2026-11-13 17:30 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 10/23] perf db-export: Store symbol database IDs in a hashmap Ian Rogers
2026-11-13 17:33 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 11/23] perf annotate: Move struct annotation to a hashmap and remove symbol_conf.priv_size Ian Rogers
2026-11-13 17:38 ` sashiko-bot
2026-11-15 4:06 ` Namhyung Kim [this message]
2026-11-13 17:17 ` [PATCH v4 12/23] perf bench internals: Add symbols benchmark Ian Rogers
2026-11-13 17:30 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 13/23] perf bench internals: Add maps benchmark Ian Rogers
2026-11-13 17:30 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 14/23] perf demangle: Add fast-path prefix checks for Rust and Java demanglers Ian Rogers
2026-11-13 17:28 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 15/23] perf symbol-elf: Cache ELF program/section headers and defer symbol name lookup Ian Rogers
2026-11-13 17:30 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 16/23] perf maps: Optimize tail insertion and small-append sorting Ian Rogers
2026-11-13 17:43 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 17/23] perf symbol: Add accessor functions for struct symbol fields Ian Rogers
2026-11-13 17:41 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 18/23] perf symbol: Switch backing storage from rbtree to struct symbols array Ian Rogers
2026-11-13 17:40 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 19/23] perf symbol: Optimize symbol sorting with natural-run merge sort and binary insertion Ian Rogers
2026-11-13 17:38 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 20/23] perf symbol: Add memory shrinking for symbols, DSOs, and machines Ian Rogers
2026-11-13 17:54 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 21/23] perf session: Add dso__session() and session-scoped allocation wrappers Ian Rogers
2026-11-13 17:37 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 22/23] perf symbol: Use session allocation wrappers in symbol, DSO, thread, and hist paths Ian Rogers
2026-11-13 17:46 ` sashiko-bot
2026-11-13 17:17 ` [PATCH v4 23/23] perf test symbols: Add tests for symbol shrinking and session alloc wrappers Ian Rogers
2026-11-13 17:37 ` sashiko-bot
2026-11-14 5:25 ` [PATCH v4 00/23] perf symbol: Sorted arrays, DSO-owned lifetimes, and memory shrinking Alireza Haghdoost
2026-11-15 3:35 ` Namhyung Kim
2026-11-15 3:31 ` Namhyung Kim
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=avkvqOTFLHODjjrr@z2 \
--to=namhyung@kernel.org \
--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=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