perf script: Bounded and lazy symbol loading
v2 cover perf script: Bounded and lazy symbol loading
perf script loads the entire ELF symbol table of every DSO that appears in a sample, allocating each symbol into an rb-tree held until process exit. Therefore, a large enough profile turns symbol loading into an OOM kill.
This is not scalable for profiling a large cgroup with a lot of large binaries on a production system with limited free memory.
This series adds two independent, opt-in mechanisms and a leading regression fix they build on:
[1/4] Fix a broken "#ifdef ELF_C_READ_MMAP" guard so perf actually
mmaps ELF files instead of malloc'ing section data. This is a standalone regression fix that is introduced by 22dd1ac91a77.
[2/4] --max-symbol-bytes <size>: a byte budget on struct symbol
allocations (and the lazy index) enforced at the ELF symbol loader, degrading to [unknown] with a warning past the cap. An unbounded profile doesn't just risk OOM-killing itself. It also forces memory pressure on the whole host, pushing the kernel to reclaim from co-located latency-sensitive processes. Capping it lets the user bound that footprint up front and choose the trade-off explicitly.
[3/4] --lazy-load-symbols: build a compact per-DSO sorted index and
resolve only the sampled addresses, reading names through the DSO data cache at lookup time. On the production fixture, peak RssAnon drops from 265 MiB to 39 MiB (6.8x) and wall time from 3.1 s to 1.85 s (1.7x). Memory optimizations usually cost time; this one does not because lazy loading skips a lot of calloc and demangle calls.
[4/4] Shell and unit tests for both options.
Lazy loading handles the common userspace ELF symtab/dynsym path. Eager loading remains available for dense coverage and for PPC64 .opd and .gnu_debugdata.
Changes in v2:
- Replace direct pread() name reads with the exact symbol source's DSO data cache, preserving split-debuginfo offsets and descriptor reopen behavior.
- Drop the byte-identical-output claim and retain eager loading for PPC64 .opd and .gnu_debugdata.
- Make the symbol budget atomic and strict, account complete name lengths, accept a bare 0 as unlimited, and keep partial zero-sized ranges from covering omitted symbols.
- Align lazy lookup with eager duplicate and IFUNC selection, PLT clipping, and name-sorted materialization.
- Move option documentation into the feature patches. Add unit and shell coverage for cache reopen, truncated names, budget truncation, and skip handling.
---
Alireza Haghdoost (4):
perf symbols: Fix broken ELF_C_READ_MMAP fallback guard perf script: Add --max-symbol-bytes to bound ELF symbol memory perf script: Add --lazy-load-symbols for lazy symbol loading perf test: Test lazy symbol loading and symbol memory limits
tools/perf/Documentation/perf-script.txt | 28 + tools/perf/arch/powerpc/util/sym-handling.c | 5 +- tools/perf/builtin-script.c | 44 ++ tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/shell/script_lazy_load_symbols.sh | 278 ++++++++ .../tests/shell/script_lazy_load_symbols_skip.sh | 26 + tools/perf/tests/symbol-bytes.c | 340 ++++++++++ tools/perf/tests/tests.h | 1 + tools/perf/util/dso.c | 63 +- tools/perf/util/dso.h | 49 ++ tools/perf/util/map.c | 30 +- tools/perf/util/symbol-elf.c | 733 ++++++++++++++++++++- tools/perf/util/symbol-minimal.c | 17 + tools/perf/util/symbol.c | 140 +++- tools/perf/util/symbol.h | 24 +- tools/perf/util/symbol_conf.h | 2 + 17 files changed, 1723 insertions(+), 59 deletions(-)
---
base-commit: aa18964dd64511305de0711fed912054da6f5d18
change-id: 20260915-perf-symbol-memory-send-e7cfca1ac3d9
Best regards,
Signature · 1 line
Alireza Haghdoost <[email protected]>
PATCH v2 1/4 perf symbols: Fix broken ELF_C_READ_MMAP fallback guard
Commit 22dd1ac91a77 ("tools: Remove feature-libelf-mmap feature detection") replaced perf's compile-time feature test with an #ifdef on ELF_C_READ_MMAP. ELF_C_READ_MMAP is an Elf_Cmd enumerator rather than a preprocessor macro, so the condition is always false and perf silently uses ELF_C_READ.
Perf already requires a sufficiently recent elfutils version that provides ELF_C_READ_MMAP. Use the enumerator directly instead of restoring a feature probe or retaining an unreachable fallback.
--- tools/perf/util/symbol.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
tools/perf/util/symbol.h +1 -9
@@ -57,15 +57,7 @@ static inline bool is_livepatch_symbol(const char *str)return strstarts (str,KLP_SYM_PREFIX ); } -/* -* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; -* for newer versions we can use mmap to reduce memory usage: -*/ -#ifdef ELF_C_READ_MMAP -# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP -#else -# define PERF_ELF_C_READ_MMAP ELF_C_READ -#endif +#define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP#ifdef HAVE_LIBELF_SUPPORT Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
Signature · 1 line
Git-157)
[email protected]
AI reviewRe: [PATCH v2 1/4] perf symbols: Fix broken ELF_C_READ_MMAP fallback guard
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] perf: build failure on non-elfutils systems due to removed ELF_C_READ_MMAP fallback --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf: build failure on non-elfutils systems due to removed ELF_C_READ_MMAP fallback --
commit 85681e93b31655f473355c4d4ba6288016a5ebcd
Author: Alireza Haghdoost <[email protected]>
perf symbols: Fix broken ELF_C_READ_MMAP fallback guard
This commit removes the compile-time fallback guard for ELF_C_READ_MMAP, relying on the assumption that perf already requires a recent elfutils version that provides this enumerator. It replaces the conditional definition with an unconditional one.
Quoted 8 lines
tools/perf/util/symbol.h +0
-0@@ -57,15 +57,7 @@ static inline bool is_livepatch_symbol(const char *str)return strstarts (str,KLP_SYM_PREFIX ); }
tools/perf/util/symbol.h static inline bool is_livepatch_symbol(const char *str) · line 60
Quoted 10 lines
tools/perf/util/symbol.h +1
-9-/* -* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; -* for newer versions we can use mmap to reduce memory usage: -*/ -#ifdef ELF_C_READ_MMAP -# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP -#else -# define PERF_ELF_C_READ_MMAP ELF_C_READ -#endif +#define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
[Severity: Low]
Does this unconditional reference cause a build failure on systems using alternative libelf implementations?
ELF_C_READ_MMAP is an elfutils-specific extension and is undefined in alternative implementations like elftoolchain, or in older libelf releases.
The perf build system verifies basic libelf support via test-libelf.c, which only probes for ELF_C_READ. If a non-elfutils libelf is installed, the feature test successfully passes and sets HAVE_LIBELF_SUPPORT.
When the compiler then evaluates symbol.h, the unconditional reference to ELF_C_READ_MMAP will trigger an 'undeclared identifier' error.
Should this optional library extension be dynamically probed (e.g., via test-libelf-mmap.c) and safely guarded with fallbacks to avoid breaking builds on non-elfutils systems?
Quoted 3 lines
tools/perf/util/symbol.h +0
-0#ifdef HAVE_LIBELF_SUPPORT Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH v2 1/4] perf symbols: Fix broken ELF_C_READ_MMAP fallback guard
In reply to Alireza HaghdoostHello,
Quoted 8 lines · On Sat, Sep 19, 2026 at 07:33:56PM -0700, Alireza Haghdoost via B4 Relay wrote:
From: Alireza Haghdoost <[email protected]>
Commit
22dd1ac91a77("tools: Remove feature-libelf-mmap feature detection") replaced perf's compile-time feature test with an #ifdef onELF_C_READ_MMAP.ELF_C_READ_MMAPis anElf_Cmdenumerator rather than a preprocessor macro, so the condition is always false and perf silently usesELF_C_READ.
Quoted 6 lines
Perf already requires a sufficiently recent elfutils version that provides
ELF_C_READ_MMAP. Use the enumerator directly instead of restoring a feature probe or retaining an unreachable fallback.Fixes 22dd1ac91a77 ("tools: Remove feature-libelf-mmap feature detection")Signed-off-by Alireza Haghdoost <[email protected]>
Thanks,
Namhyung
Quoted 30 lines
--- tools/perf/util/symbol.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)tools/perf/util/symbol.h +1
-9@@ -57,15 +57,7 @@ static inline bool is_livepatch_symbol(const char *str)return strstarts (str,KLP_SYM_PREFIX ); } -/* -* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; -* for newer versions we can use mmap to reduce memory usage: -*/ -#ifdef ELF_C_READ_MMAP -# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP -#else -# define PERF_ELF_C_READ_MMAP ELF_C_READ -#endif +#define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP#ifdef HAVE_LIBELF_SUPPORT Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,Signature · 2 lines
-- Git-157)
PATCH v2 2/4 perf script: Add --max-symbol-bytes to bound ELF symbol memory
In reply to Alireza Haghdoostperf script eagerly materializes every ELF symbol into an rb-tree kept until process exit. Large profiles can therefore consume substantial anonymous memory, causing perf script to be OOM-killed or forcing the kernel to reclaim memory from co-located workloads.
This patch adds --max-symbol-bytes to bound struct symbol allocations. Once the budget is reached, the ELF loader stops loading symbols, warns once, and lets unresolved addresses appear as [unknown]. This allows users to bound the memory footprint upfront and explicitly choose between complete symbolization and avoiding unbounded host memory pressure. perf record already provides a similar --max-size option to bound disk usage.
The counter includes every symbol__new() allocation, but this patch enforces the limit only in the ELF loader, which is the source of the unbounded memory growth addressed here. In this path, reaching the limit can safely produce [unknown] symbols. Other loaders currently treat a failed symbol allocation as an error. Capping those paths would therefore require separate changes whose complexity may outweigh the potential memory savings.
The cap applies to userspace DSOs, vmlinux-as-ELF, and kernel modules. Sizes require a B/K/M/G suffix, except that a bare 0 and the default mean unlimited. Reservations are atomic so concurrent loaders cannot exceed the limit; accounting retains complete name lengths and partial zero-sized symbol ranges do not cover omitted addresses.
Document the option with the code that introduces it and add focused accounting and concurrent-reservation tests.
--- tools/perf/Documentation/perf-script.txt | 10 +++ tools/perf/builtin-script.c | 42 +++++++++ tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/symbol-bytes.c | 143 +++++++++++++++++++++++++++++++ tools/perf/tests/tests.h | 1 + tools/perf/util/symbol-elf.c | 66 +++++++++++--- tools/perf/util/symbol.c | 82 +++++++++++++++++- tools/perf/util/symbol.h | 8 +- tools/perf/util/symbol_conf.h | 1 + 10 files changed, 340 insertions(+), 15 deletions(-)
tools/perf/Documentation/perf-script.txt +10 -0
@@ -412,6 +412,16 @@ include::itrace.txt[] Default: 127 +--max-symbol-bytes:: + Limit the bytes held in struct symbol allocations for DSOs on the + libelf symbol-loader path: userspace DSOs, vmlinux-as-ELF, and kernel + modules. This is not a cap on all symbol memory or RSS: symbols from + kallsyms, JIT maps, and libbfd are counted but not capped. Accepts a + size with a B/K/M/G suffix (e.g. 128M). When the budget is exceeded, + the ELF loader stops adding symbols; addresses not covered by symbols + already loaded are then printed as [unknown]. A warning is printed. + Default: 0 (unlimited). + --ns:: Use 9 decimal places when displaying time (i.e. show the nanoseconds)
tools/perf/builtin-script.c +42 -0
60 lines not on this page · raw message
tools/perf/tests/Build +1 -0
@@ -66,6 +66,7 @@ perf-test-y += dlfilter-test.o perf-test-y += sigtrap.o perf-test-y += event_groups.o perf-test-y += symbols.o +perf-test-y += symbol-bytes.o perf-test-y += util.o perf-test-y += hwmon_pmu.o perf-test-y += tool_pmu.o
tools/perf/tests/builtin-test.c +1 -0
@@ -150,6 +150,7 @@ static struct test_suite *generic_tests[] = { &suite__sigtrap, &suite__event_groups, &suite__symbols, + &suite__symbol_bytes, &suite__util, &suite__subcmd_help, &suite__kallsyms_split,
tools/perf/tests/symbol-bytes.c new file +143 -0
143 lines not on this page · raw message
tools/perf/tests/tests.h +1 -0
@@ -178,6 +178,7 @@ DECLARE_SUITE(dlfilter);DECLARE_SUITE (sigtrap);DECLARE_SUITE (event_groups);DECLARE_SUITE (symbols); +DECLARE_SUITE (symbol_bytes);DECLARE_SUITE (util);DECLARE_SUITE (uncore_event_sorting);DECLARE_SUITE (subcmd_help);
tools/perf/util/symbol-elf.c +56 -10
128 lines not on this page · raw message
tools/perf/util/symbol.c +78 -4
105 lines not on this page · raw message
tools/perf/util/symbol.h +7 -1
@@ -90,7 +90,7 @@ struct symbol {u64 start;u64 end;/** Length of the string name. */ -u16 namelen; +u32 namelen; _Atomicuint16_t flags;/** Architecture specific. Unused except on PPC where it holds st_other. */ u8 arch_sym;
@@ -227,6 +227,12 @@ void symbol__elf_init(void);int symbol__annotation_init (void );struct symbol *symbol__new (u64 start,u64 len,u8 binding,u8 type,const char *name); +struct symbol *symbol__new_bounded (u64 start,u64 len,u8 binding,u8 type, +const char *name,bool *budget_exceeded); +size_t symbol__bytes_used (void ); +void symbol__account_bytes (size_t bytes); +bool symbol__try_account_bytes (size_t bytes); +void symbol__unaccount_bytes (size_t bytes); size_t __symbol__fprintf_symname_offs(const struct symbol *sym, const struct addr_location *al, bool unknown_as_addr,
tools/perf/util/symbol_conf.h +1 -0
@@ -120,6 +120,7 @@ struct symbol_conf {int pad_output_len_dso;int group_sort_idx;int addr_range; +unsigned long max_symbol_bytes;DECLARE_BITMAP (parallelism_filter,MAX_NR_CPUS +1 ); };
Signature · 1 line
Git-157)
[email protected]
AI reviewRe: [PATCH v2 2/4] perf script: Add --max-symbol-bytes to bound ELF symbol memory
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] perf: missing <stdbool.h> in symbol-bytes.c --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf: missing <stdbool.h> in symbol-bytes.c
--
commit 43444932791d9e1c6b50bba8362920738abe2410
Author: Alireza Haghdoost <[email protected]>
perf script: Add --max-symbol-bytes to bound ELF symbol memory
This commit adds a new --max-symbol-bytes option to bound the memory consumed by struct symbol allocations. Once the specified budget is reached, the ELF loader stops loading new symbols and prints unresolved addresses as unknown.
Quoted 3 lines
tools/perf/builtin-script.c +0
-0
[ ... ]
Quoted 7 lines
tools/perf/builtin-script.c +3
-0@@ -4035,6 +4036,44 @@ static int parse_callret_trace(const struct option *opt __maybe_unused,return 0 ; } +static int parse_max_symbol_bytes (const struct option *opt, +const char *str,int unset) +{
[ ... ]
tools/perf/builtin-script.c static int parse_callret_trace(const struct option *opt __maybe_unused, · line 4065
Quoted 8 lines
tools/perf/builtin-script.c +8
-0+if (!strcmp (str,"0" )) { + *max_bytes =0 ; +return 0 ; + } + + len =strlen (str); +if (len <2 || !strchr ("BKMG" , str[len -1 ]) || +strspn (str,"0123456789" ) != len -1 )
[Severity: Low]
This is a pre-existing issue, but parse_max_symbol_bytes() introduces direct calls to libc string functions like strcmp() and strlen(). Since this file lacks an explicit include of the POSIX <string.h> header, does this cause compilation failures in musl libc environments where headers are not implicitly included?
Quoted 3 lines
tools/perf/tests/symbol-bytes.c new file +0
-0
[ ... ]
tools/perf/tests/symbol-bytes.c line 61
Quoted 3 lines
tools/perf/tests/symbol-bytes.c new file +3
-0+struct reserve_arg { +size_t bytes; +bool success;
[Severity: Low]
This struct uses the bool type, but the file doesn't explicitly include <stdbool.h>. Can this cause a compilation failure under stricter libc environments like musl due to the missing type definition?
Quoted 3 lines
tools/perf/tests/symbol-bytes.c new file +3
-0+}; + +static void *reserve_bytes (void *data)
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Namhyung Kim
maintainerRe: [PATCH v2 2/4] perf script: Add --max-symbol-bytes to bound ELF symbol memory
In reply to Alireza HaghdoostQuoted 33 lines · On Sat, Sep 19, 2026 at 07:33:57PM -0700, Alireza Haghdoost via B4 Relay wrote:
From: Alireza Haghdoost <[email protected]>
perf script eagerly materializes every ELF symbol into an rb-tree kept until process exit. Large profiles can therefore consume substantial anonymous memory, causing perf script to be OOM-killed or forcing the kernel to reclaim memory from co-located workloads.
This patch adds --max-symbol-bytes to bound struct symbol allocations. Once the budget is reached, the ELF loader stops loading symbols, warns once, and lets unresolved addresses appear as [unknown]. This allows users to bound the memory footprint upfront and explicitly choose between complete symbolization and avoiding unbounded host memory pressure. perf record already provides a similar --max-size option to bound disk usage.
The counter includes every
symbol__new()allocation, but this patch enforces the limit only in the ELF loader, which is the source of the unbounded memory growth addressed here. In this path, reaching the limit can safely produce [unknown] symbols. Other loaders currently treat a failed symbol allocation as an error. Capping those paths would therefore require separate changes whose complexity may outweigh the potential memory savings.The cap applies to userspace DSOs, vmlinux-as-ELF, and kernel modules. Sizes require a B/K/M/G suffix, except that a bare 0 and the default mean unlimited. Reservations are atomic so concurrent loaders cannot exceed the limit; accounting retains complete name lengths and partial zero-sized symbol ranges do not cover omitted addresses.
Document the option with the code that introduces it and add focused accounting and concurrent-reservation tests.
Signed-off-by Alireza Haghdoost <[email protected]>---
[SNIP]
tools/perf/util/symbol.h struct symbol { · line 93
Quoted 10 lines
tools/perf/util/symbol.h +1
-1@@ -90,7 +90,7 @@ struct symbol {u64 start;u64 end;/** Length of the string name. */ -u16 namelen; +u32 namelen;
Why is this needed? Do you have symbols with a really long name? Anyway, it should be a separate change then.
Thanks,
Namhyung
Quoted 33 lines
tools/perf/util/symbol.h +6
-0_Atomicuint16_t flags;/** Architecture specific. Unused except on PPC where it holds st_other. */ u8 arch_sym;@@ -227,6 +227,12 @@ void symbol__elf_init(void);int symbol__annotation_init (void );struct symbol *symbol__new (u64 start,u64 len,u8 binding,u8 type,const char *name); +struct symbol *symbol__new_bounded (u64 start,u64 len,u8 binding,u8 type, +const char *name,bool *budget_exceeded); +size_t symbol__bytes_used (void ); +void symbol__account_bytes (size_t bytes); +bool symbol__try_account_bytes (size_t bytes); +void symbol__unaccount_bytes (size_t bytes); size_t __symbol__fprintf_symname_offs(const struct symbol *sym, const struct addr_location *al, bool unknown_as_addr,tools/perf/util/symbol_conf.h +1
-0@@ -120,6 +120,7 @@ struct symbol_conf {int pad_output_len_dso;int group_sort_idx;int addr_range; +unsigned long max_symbol_bytes;DECLARE_BITMAP (parallelism_filter,MAX_NR_CPUS +1 ); };Signature · 2 lines
-- Git-157)
Re: [PATCH v2 2/4] perf script: Add --max-symbol-bytes to bound ELF symbol memory
Quoted 10 lines
tools/perf/util/symbol.h struct symbol { · line 93
Quoted 6 lines
tools/perf/util/symbol.h +1
-1@@ -90,7 +90,7 @@ struct symbol {u64 start;u64 end;/** Length of the string name. */ -u16 namelen; +u32 namelen;Why is this needed? Do you have symbols with a really long name? Anyway, it should be a separate change then.
I will drop this change in the v3. This is a theoretical edge case and I don’t have a real workload
that hits it.
PATCH v2 3/4 perf script: Add --lazy-load-symbols for lazy symbol loading
In reply to Alireza Haghdoostperf script eagerly materializes eligible symbols from every DSO encountered in samples. On a production fixture, it loaded about 765k symbols to resolve about 45k distinct (DSO, symbol) frames, exceeding the memory available in a memory-constrained cgroup.
This patch adds --lazy-load-symbols for userspace ELF DSOs. It builds a compact sorted index, resolves sampled addresses by binary search, reads symbol names through a private data-source DSO, and caches resolved symbols in the existing rb-tree. The private DSO uses the normal DSO data cache, so the exact split-debuginfo source can be reopened after descriptor eviction. If the source cannot be read during preflight, perf discards the index and eagerly loads that DSO instead.
On the same fixture, peak RssAnon drops from 265 MiB to 39 MiB and wall time from 3.1 seconds to 1.85 seconds. Memory optimizations usually cost time; this one does not because lazy loading skips many unnecessary calloc() calls and demangling operations.
Lazy loading is most effective when samples reference only a small fraction of the available symbols, such as profiles spanning many large DSOs. It still builds an index proportional to the total symbol count. Eager loading remains available for dense symbol coverage or cases requiring its broader ELF and architecture support.
This does not claim full parity with the eager loader. Lazy loading supports the common userspace ELF symtab/dynsym case; .gnu_debugdata and PPC64 .opd continue through the eager loader.
Materialization is serialized with the DSO lock. Name lookups materialize the remaining index before constructing the name-sorted array. Lazy loading shares eager duplicate and IFUNC selection, and clips ranges that cross .plt before synthesizing PLT symbols.
--- tools/perf/Documentation/perf-script.txt | 34 +- tools/perf/arch/powerpc/util/sym-handling.c | 5 +- tools/perf/builtin-script.c | 4 +- tools/perf/tests/symbol-bytes.c | 139 ++++++ tools/perf/util/dso.c | 63 ++- tools/perf/util/dso.h | 49 ++ tools/perf/util/map.c | 30 +- tools/perf/util/symbol-elf.c | 667 ++++++++++++++++++++++++++++ tools/perf/util/symbol-minimal.c | 17 + tools/perf/util/symbol.c | 58 ++- tools/perf/util/symbol.h | 6 +- tools/perf/util/symbol_conf.h | 1 + 12 files changed, 1029 insertions(+), 44 deletions(-)
tools/perf/Documentation/perf-script.txt +26 -8
@@ -412,15 +412,33 @@ include::itrace.txt[] Default: 127 +--lazy-load-symbols:: + Resolve symbols lazily instead of eagerly loading the full + symbol table of every DSO that appears in a sample. A compact + sorted index is built per DSO and only the addresses that appear + in samples are materialized into symbols, with names read from the + file's string table through the DSO data cache at lookup time. This + sharply reduces memory + (and usually time) for profiles of large binaries where only a + small fraction of the symbol table is referenced. This applies only + to userspace ELF DSOs; kernel DSOs and modules always load eagerly. + Operations that look up a symbol by name materialize the remainder + of that DSO's index first to preserve name-lookup behavior. + Output may differ from the default loader for some targets + (e.g. PPC64 .opd or .gnu_debugdata). Default: off. + --max-symbol-bytes:: - Limit the bytes held in struct symbol allocations for DSOs on the - libelf symbol-loader path: userspace DSOs, vmlinux-as-ELF, and kernel - modules. This is not a cap on all symbol memory or RSS: symbols from - kallsyms, JIT maps, and libbfd are counted but not capped. Accepts a - size with a B/K/M/G suffix (e.g. 128M). When the budget is exceeded, - the ELF loader stops adding symbols; addresses not covered by symbols - already loaded are then printed as [unknown]. A warning is printed. - Default: 0 (unlimited). + Limit the bytes held in struct symbol allocations (and, with + --lazy-load-symbols, the lazy index) for DSOs on the ELF symbol + loader path -- userspace DSOs plus vmlinux-as-ELF and kernel + modules. This is not a cap on all symbol memory or RSS: symbols + from kallsyms, JIT maps, and libbfd are counted but not capped. + Accepts a size with a B/K/M/G suffix (e.g. 128M). + When the budget is exceeded, the ELF loader stops adding symbols; + addresses not covered by the symbols already loaded are then printed + as [unknown]. A warning is printed. This is a safety net independent of + --lazy-load-symbols and can be used with or without it. Default: 0 + (unlimited). --ns:: Use 9 decimal places when displaying time (i.e. show the nanoseconds)
tools/perf/arch/powerpc/util/sym-handling.c +2 -3
@@ -10,10 +10,9 @@#include "probe-event.h" #include "probe-file.h" -int arch__choose_best_symbol (struct symbol *syma, -struct symbol *symb__maybe_unused ) +int arch__choose_best_symbol (const char *syma_name) { -char *sym = syma->name; +const char *sym = syma_name;#if !defined(_CALL_ELF) || _CALL_ELF !=2 /* Skip over any initial dot */
tools/perf/builtin-script.c +3 -1
@@ -4037,7 +4037,7 @@ static int parse_callret_trace(const struct option *opt __maybe_unused, }static int parse_max_symbol_bytes (const struct option *opt, -const char *str,int unset) +const char *str,int unset) {unsigned long *max_bytes = (unsigned long *)opt->value;static struct parse_tag size_tags[] = {
@@ -4177,6 +4177,8 @@ int cmd_script(int argc, const char **argv)OPT_CALLBACK (0 ,"max-symbol-bytes" , &symbol_conf.max_symbol_bytes,"size" ,"Limit bytes for ELF struct symbol (e.g. 128M; 0=unlimited)" , parse_max_symbol_bytes), +OPT_BOOLEAN (0 ,"lazy-load-symbols" , &symbol_conf.lazy_load_symbols, +"Resolve symbols lazily instead of loading full symtabs" ),OPT_BOOLEAN (0 ,"reltime" , &reltime,"Show time stamps relative to start" ),OPT_BOOLEAN (0 ,"deltatime" , &deltatime,"Show time stamps relative to previous event" ), OPT_BOOLEAN('I', "show-info", &show_full_info,
tools/perf/tests/symbol-bytes.c +139 -0
159 lines not on this page · raw message
tools/perf/util/dso.c +54 -9
97 lines not on this page · raw message
tools/perf/util/dso.h +49 -0
85 lines not on this page · raw message
tools/perf/util/map.c +29 -1
@@ -382,10 +382,28 @@ int map__load(struct map *map)struct symbol *map__find_symbol (struct map *map,u64 addr) { +struct dso *dso; +struct symbol *sym; +if (map__load (map) <0 )return NULL ; -return dso__find_symbol (map__dso (map), addr); + dso =map__dso (map); +if (dso__ondemand (dso)) { +/* +* On-demand lookup may materialize and insert a symbol. Keep +* both the lookup and insertion under the DSO lock so another +* thread cannot traverse or modify the rb-tree concurrently. +*/ +mutex_lock (dso__lock (dso)); + sym =dso__find_symbol (dso, addr); +if (!sym) + sym =dso__find_symbol_ondemand (dso, addr); +mutex_unlock (dso__lock (dso)); + }else { + sym =dso__find_symbol (dso, addr); + } +return sym; }struct symbol *map__find_symbol_by_name_idx (struct map *map,const char *name,size_t *idx)
@@ -396,6 +414,16 @@ struct symbol *map__find_symbol_by_name_idx(struct map *map, const char *name, sreturn NULL ; dso =map__dso (map); +if (dso__ondemand (dso)) { +mutex_lock (dso__lock (dso)); +/* +* Name lookup requires a complete name-sorted array. Preserve +* that API by materializing the remaining address index first. +* An explicit symbol-byte limit can leave a partial set. +*/ +dso__materialize_symbols_ondemand (dso); +mutex_unlock (dso__lock (dso)); + }dso__sort_by_name (dso);return dso__find_symbol_by_name (dso, name, idx);
tools/perf/util/symbol-elf.c +667 -0
721 lines not on this page · raw message
tools/perf/util/symbol-minimal.c +17 -0
@@ -373,6 +373,23 @@ void symbol__elf_init(void) { } +struct symbol *dso__find_symbol_ondemand (struct dso *dso__maybe_unused , +u64 addr__maybe_unused ) +{ +return NULL ; +} + +struct symbol *dso__find_symbol_ondemand_exact (struct dso *dso__maybe_unused , +u64 addr__maybe_unused ) +{ +return NULL ; +} + +int dso__materialize_symbols_ondemand (struct dso *dso__maybe_unused ) +{ +return 0 ; +} +bool filename__has_section (const char *filename__maybe_unused ,const char *sec__maybe_unused ) {return false;
tools/perf/util/symbol.c +37 -21
120 lines not on this page · raw message
tools/perf/util/symbol.h +5 -1
@@ -233,6 +233,10 @@ size_t symbol__bytes_used(void);void symbol__account_bytes (size_t bytes);bool symbol__try_account_bytes (size_t bytes);void symbol__unaccount_bytes (size_t bytes); +int symbol__choose_best (u64 a_size,u8 a_type,u8 a_binding, +const char *a_name, +u64 b_size,u8 b_type,u8 b_binding, +const char *b_name); size_t __symbol__fprintf_symname_offs(const struct symbol *sym, const struct addr_location *al, bool unknown_as_addr,
@@ -308,7 +312,7 @@ const char *arch__normalize_symbol_name(const char *name);int arch__compare_symbol_names (const char *namea,const char *nameb);int arch__compare_symbol_names_n (const char *namea,const char *nameb,unsigned int n); -int arch__choose_best_symbol (struct symbol *syma,struct symbol *symb); +int arch__choose_best_symbol (const char *syma_name);enum symbol_tag_include {SYMBOL_TAG_INCLUDE__NONE =0 ,
tools/perf/util/symbol_conf.h +1 -0
@@ -74,6 +74,7 @@ struct symbol_conf { no_buildid_mmap2, guest_code, lazy_load_kernel_maps, + lazy_load_symbols, keep_exited_threads, annotate_data_member, annotate_data_sample,
Signature · 1 line
Git-157)
[email protected]
AI reviewRe: [PATCH v2 3/4] perf script: Add --lazy-load-symbols for lazy symbol loading
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] perf: Use-After-Free of dso->symbol_names during concurrent lazy materialization - [Medium] perf…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] perf: Use-After-Free of dso->symbol_names during concurrent lazy materialization
- [Medium] perf: missing memory barrier in dso__ondemand check leads to rbtree corruption --
commit 2498c78d5ec3921571fc9c4a22667912c81f3010
Author: Alireza Haghdoost <[email protected]>
perf script: Add --lazy-load-symbols for lazy symbol loading
This commit adds a lazy-load-symbols option to perf script to resolve symbols lazily instead of loading full symtabs. It builds a compact sorted index and materializes symbols that appear in samples, which reduces memory footprint when profiling large binaries.
Quoted 3 lines
tools/perf/util/dso.c +0
-0
[ ... ]
tools/perf/util/dso.c void dso__set_sorted_by_name(struct dso *dso) · line 1699
Quoted 3 lines
tools/perf/util/dso.c +3
-0+void dso__reset_symbol_names (struct dso *dso) +{ +zfree (&RC_CHK_ACCESS (dso)->symbol_names);
[Severity: High]
Can this zfree() lead to a use-after-free during concurrent lookups?
If dso__materialize_symbols_ondemand() returns early due to max-symbol-bytes budget limits during a concurrent lookup by name in map__find_symbol_by_name_idx(), the dso__ondemand pointer is left non-NULL. The thread then calls dso__sort_by_name(), constructing the dso->symbol_names array, and begins a lockless binary search on it.
Concurrently, a lookup by address in another thread evaluates dso__ondemand, takes the lock, calls dso__find_symbol_ondemand(), and successfully materializes a different symbol. This triggers dso__reset_symbol_names(), which immediately frees dso->symbol_names via zfree() while the first thread is actively reading it.
tools/perf/util/dso.c void dso__set_sorted_by_name(struct dso *dso) · line 1710
Quoted 11 lines
tools/perf/util/dso.c +11
-0+RC_CHK_ACCESS (dso)->symbol_names_len =0 ; +RC_CHK_ACCESS (dso)->sorted_by_name = false; +} + +void dso__free_ondemand (struct dso *dso) +{ +struct dso_ondemand *od =RC_CHK_ACCESS (dso)->ondemand; + +if (!od) +return ; +RC_CHK_ACCESS (dso)->ondemand =NULL ;
[Severity: Medium]
Does this missing release barrier risk exposing partially written rbtree nodes?
A thread evaluating dso__ondemand locklessly in map__find_symbol() could read the state as NULL, bypassing the dso__lock acquisition, and proceed to traverse the rbtree. Another thread executing dso__free_ondemand() stores NULL into dso->ondemand as a plain write.
Without smp_store_release() on the writer and smp_load_acquire() on the reader, a weakly-ordered CPU can reorder the reader's loads such that it reads the rbtree nodes before ondemand is loaded, observing stale memory.
Quoted 6 lines
tools/perf/util/dso.c +6
-0+free (od->sorted); +symbol__unaccount_bytes (od->nr_alloc *sizeof (*od->sorted)); +dso__data_close (od->data_dso); +dso__put (od->data_dso); +free (od); +}
[ ... ]
Quoted 3 lines
tools/perf/util/map.c +0
-0
[ ... ]
tools/perf/util/map.c int map__load(struct map *map) · line 392
Quoted 11 lines
struct symbol *map__find_symbol(struct map *map, u64 addr) {
tools/perf/util/map.c +5
-1+struct dso *dso; +struct symbol *sym; +if (map__load (map) <0 )return NULL ; -return dso__find_symbol (map__dso (map), addr); + dso =map__dso (map); +if (dso__ondemand (dso)) {
[Severity: Medium]
This is the lockless read mentioned above. Is an smp_load_acquire() needed here to pair with a release barrier in dso__free_ondemand()?
Quoted 24 lines
tools/perf/util/map.c +17
-0+/* +* On-demand lookup may materialize and insert a symbol. Keep +* both the lookup and insertion under the DSO lock so another +* thread cannot traverse or modify the rb-tree concurrently. +*/ +mutex_lock (dso__lock (dso)); + sym =dso__find_symbol (dso, addr); +if (!sym) + sym =dso__find_symbol_ondemand (dso, addr); +mutex_unlock (dso__lock (dso)); + }else { + sym =dso__find_symbol (dso, addr); + } +return sym; }struct symbol *map__find_symbol_by_name_idx (struct map *map,const char *name,size_t *idx)@@ -396,6 +414,16 @@ struct symbol *map__find_symbol_by_name_idx(struct map *map, const char *name, sreturn NULL ; dso =map__dso (map); +if (dso__ondemand (dso)) { +mutex_lock (dso__lock (dso)); +/*
tools/perf/util/map.c struct symbol *map__find_symbol_by_name_idx(struct map *map, const char *name, s · line 429
Quoted 10 lines
tools/perf/util/map.c +7
-0+* Name lookup requires a complete name-sorted array. Preserve +* that API by materializing the remaining address index first. +* An explicit symbol-byte limit can leave a partial set. +*/ +dso__materialize_symbols_ondemand (dso); +mutex_unlock (dso__lock (dso)); + }dso__sort_by_name (dso);return dso__find_symbol_by_name (dso, name, idx);
[Severity: High]
This is where the concurrent lockless binary search over dso->symbol_names happens, which may race with the zfree() in dso__reset_symbol_names().
[ ... ]
Quoted 3 lines
tools/perf/util/symbol-elf.c +0
-0
[ ... ]
Quoted 3 lines
tools/perf/util/symbol-elf.c +3
-0+static struct symbol *dso__materialize_symbol_ondemand (struct dso *dso,u32 pos) +EXCLUSIVE_LOCKS_REQUIRED (dso__lock (dso)) +{
[ ... ]
tools/perf/util/symbol-elf.c static int dso__process_kernel_symbol(struct dso *dso, struct map *map, · line 2113
Quoted 10 lines
tools/perf/util/symbol-elf.c +10
-0+ s =symbol__new_bounded (idx->start, idx->end - idx->start, + idx->binding, idx->type, name, &budget_exceeded); +free (demangled); +free (name_heap); +if (!s && budget_exceeded) +symbol_budget_warning (); +if (s) { +if (idx->flags &SYM_IDX_FLAG_IFUNC_ALIAS ) +symbol__set_ifunc_alias (s, true); +dso__reset_symbol_names (dso);
[Severity: High]
This is the call to dso__reset_symbol_names() that triggers the use-after-free if a concurrent thread is searching the array locklessly in map__find_symbol_by_name_idx().
Quoted 5 lines
tools/perf/util/symbol-elf.c +5
-0+__symbols__insert (dso__symbols (dso), s); + idx->flags |=SYM_IDX_FLAG_MATERIALIZED ; + } +return s; +}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH v2 3/4] perf script: Add --lazy-load-symbols for lazy symbol loading
Quoted 9 lines
[Severity: High]
Can thiszfree()lead to a use-after-free during concurrent lookups?If
dso__materialize_symbols_ondemand()returns early due to max-symbol-bytes budget limits during a concurrent lookup by name inmap__find_symbol_by_name_idx(), thedso__ondemandpointer is left non-NULL. The thread then callsdso__sort_by_name(), constructing thedso->symbol_namesarray, and begins a lockless binary search on it.
Quoted 5 lines
Concurrently, a lookup by address in another thread evaluates
dso__ondemand, takes the lock, callsdso__find_symbol_ondemand(), and successfully materializes a different symbol. This triggersdso__reset_symbol_names(), which immediately freesdso->symbol_namesviazfree()while the first thread is actively reading it.
This is a valid bug. The budget-truncated path can leave the lazy index active while a later address lookup invalidates symbol_names during a lockless name lookup.
I’ll synchronize name lookup with lazy materialization and add coverage in v3.
Quoted 4 lines
[Severity: Medium]
Does this missing release barrier risk exposing partially written rbtree nodes?
Quoted 9 lines
A thread evaluating
dso__ondemandlocklessly inmap__find_symbol()could read the state as NULL, bypassing thedso__lockacquisition, and proceed to traverse the rbtree. Another thread executingdso__free_ondemand()stores NULL intodso->ondemandas a plain write.Without
smp_store_release()on the writer andsmp_load_acquire()on the reader, a weakly-ordered CPU can reorder the reader's loads such that it reads the rbtree nodes before ondemand is loaded, observing stale memory.
I agree. The lockless dso__ondemand() test does not provide a happens-before relation for lazy rbtree updates.
I’ll remove this split synchronization path and make lazy-state transitions and symbol lookup use the DSO lock consistently in v3.
Quoted 5 lines
[Severity: Medium]
This is the lockless read mentioned above. Is ansmp_load_acquire()needed here to pair with a release barrier indso__free_ondemand()?
I agree. above solution would fix it.
Quoted 6 lines
[Severity: High]
This is the call todso__reset_symbol_names()that triggers the use-after-free if a concurrent thread is searching the array locklessly inmap__find_symbol_by_name_idx().
I agree. This is on invalidation side of the same race. I’ll synchronize symbol_names invalidation with name lookup and lazy materialization in v3.
Namhyung Kim
maintainerRe: [PATCH v2 3/4] perf script: Add --lazy-load-symbols for lazy symbol loading
In reply to Alireza HaghdoostQuoted 37 lines · On Sat, Sep 19, 2026 at 07:33:58PM -0700, Alireza Haghdoost via B4 Relay wrote:
From: Alireza Haghdoost <[email protected]>
perf script eagerly materializes eligible symbols from every DSO encountered in samples. On a production fixture, it loaded about 765k symbols to resolve about 45k distinct (DSO, symbol) frames, exceeding the memory available in a memory-constrained cgroup.
This patch adds --lazy-load-symbols for userspace ELF DSOs. It builds a compact sorted index, resolves sampled addresses by binary search, reads symbol names through a private data-source DSO, and caches resolved symbols in the existing rb-tree. The private DSO uses the normal DSO data cache, so the exact split-debuginfo source can be reopened after descriptor eviction. If the source cannot be read during preflight, perf discards the index and eagerly loads that DSO instead.
On the same fixture, peak RssAnon drops from 265 MiB to 39 MiB and wall time from 3.1 seconds to 1.85 seconds. Memory optimizations usually cost time; this one does not because lazy loading skips many unnecessary
calloc()calls and demangling operations.Lazy loading is most effective when samples reference only a small fraction of the available symbols, such as profiles spanning many large DSOs. It still builds an index proportional to the total symbol count. Eager loading remains available for dense symbol coverage or cases requiring its broader ELF and architecture support.
This does not claim full parity with the eager loader. Lazy loading supports the common userspace ELF symtab/dynsym case; .gnu_debugdata and PPC64 .opd continue through the eager loader.
Materialization is serialized with the DSO lock. Name lookups materialize the remaining index before constructing the name-sorted array. Lazy loading shares eager duplicate and IFUNC selection, and clips ranges that cross .plt before synthesizing PLT symbols.
Signed-off-by Alireza Haghdoost <[email protected]>---
[SNIP]
Quoted 173 lines
tools/perf/util/symbol-elf.c +173
-0+static int dso__build_ondemand_index (struct dso *dso,struct symsrc *syms_ss, +struct symsrc *runtime_ss, +int dynsym) +{ +struct dso_ondemand *od; +Elf *elf = syms_ss->elf; +GElf_Ehdr ehdr = syms_ss->ehdr; +GElf_Shdr shdr; +GElf_Shdr strshdr; +Elf_Scn *strscn, *sec_strndx; +Elf_Data *syms; +GElf_Sym sym; +Elf_Data *secstrs =NULL ; +size_t i, index_bytes, reservation_peak; +u32 count =0 , j; +u32 *name_offsets; +u64 nr_entries, strtab_offset; +u64 probe_off; +u8 probe; + +/* +* GNU debugdata is backed by a temporary decompressed fd rather than a +* reopenable source path. Keep using the eager loader for that case. +*/ +if (syms_ss->type ==DSO_BINARY_TYPE__GNU_DEBUGDATA ) +return 0 ; + +if (dynsym) + shdr = syms_ss->dynshdr; +else + shdr = syms_ss->symshdr; + + syms =elf_getdata (dynsym ? syms_ss->dynsym : syms_ss->symtab,NULL ); +if (!syms) +return -1 ; + +if (!shdr.sh_entsize) +return 0 ; + + nr_entries = shdr.sh_size / shdr.sh_entsize; +if (nr_entries >UINT32_MAX ) +return -EOVERFLOW ; + + strscn =elf_getscn (elf, shdr.sh_link); +if (!strscn || !gelf_getshdr (strscn, &strshdr)) +return -1 ; + strtab_offset = strshdr.sh_offset; + +/* +* Section name string table, used to match the eager path's +* elf_sec__filter() (text/data section check for STT_NOTYPE labels). +*/ + sec_strndx =elf_getscn (elf, ehdr.e_shstrndx); +if (sec_strndx) + secstrs =elf_getdata (sec_strndx,NULL ); + +for (i =0 ; i < nr_entries; i++) { +if (!gelf_getsym (syms, i, &sym)) +continue ; +if (ondemand_sym_ok (elf, secstrs, &sym, shdr.sh_link, + ehdr.e_machine)) + count++; + } + +if (!count) +return 0 ; +if (check_mul_overflow ((size_t )count,sizeof (*od->sorted), + &index_bytes)) +return -EOVERFLOW ; + +/* +* Account the index against the symbol memory budget: at 24 +* bytes/symbol it is the dominant on-demand cost and must count +* toward --max-symbol-bytes just like struct symbol allocations do. +*/ +if (!symbol__try_account_bytes (index_bytes)) { +symbol_budget_warning (); +return 0 ;/* fall back to the eager loader's per-symbol budget */ + } + reservation_peak =symbol__bytes_used (); + + od =zalloc (sizeof (*od)); +if (!od) { +symbol__unaccount_bytes (index_bytes); +return -1 ; + } + + od->sorted =zalloc (index_bytes); +if (!od->sorted) { +symbol__unaccount_bytes (index_bytes); +free (od); +return -1 ; + } + od->nr_alloc = count;/* allocated; the deduped count may shrink */ + name_offsets =malloc (count *sizeof (*name_offsets)); +if (!name_offsets) { +symbol__unaccount_bytes (index_bytes); +free (od->sorted); +free (od); +return -1 ; + } + + j =0 ; +for (i =0 ; i < nr_entries; i++) { +u64 adjusted; +GElf_Phdr phdr; + +if (!gelf_getsym (syms, i, &sym)) +continue ; +if (!ondemand_sym_ok (elf, secstrs, &sym, shdr.sh_link, + ehdr.e_machine)) +continue ; + + adjusted = sym.st_value; + +if ((ehdr.e_machine ==EM_ARM ) && + (GELF_ST_TYPE (sym.st_info) ==STT_FUNC ) && + (adjusted &1 )) + --adjusted; + +/* +* Program header adjustment, identical to the eager loop: +* read the PT_LOAD containing the symbol from the runtime +* ELF (the debug-info file may have zeroed p_offset), and +* fall back to the section-header bias when no program +* header matches -- exactly what the eager path does when +* elf_read_program_header fails. +*/ +if (elf_read_program_header (runtime_ss->elf, adjusted, + &phdr) ==0 ) { + adjusted -= phdr.p_vaddr - phdr.p_offset; + }else { +Elf_Scn *sym_sec =elf_getscn (elf, sym.st_shndx); +GElf_Shdr sym_shdr; + +if (sym_sec &&gelf_getshdr (sym_sec, &sym_shdr)) + adjusted -= sym_shdr.sh_addr - sym_shdr.sh_offset; + } + + od->sorted[j].start = adjusted; + od->sorted[j].end = sym.st_size;/* st_size for now, converted later */ +/* +* Sort equal-start aliases in original symtab order to match +* rb-tree insertion order. Restore st_name after sorting. +*/ + name_offsets[j] = sym.st_name; + od->sorted[j].name_off = j; + od->sorted[j].binding =GELF_ST_BIND (sym.st_info); + od->sorted[j].type =GELF_ST_TYPE (sym.st_info); + j++; + } + count = j; +if (!count) { +symbol__unaccount_bytes (index_bytes); +free (name_offsets); +free (od->sorted); +free (od); +return 0 ; + } + +qsort (od->sorted, count,sizeof (*od->sorted), cmp_sym_idx); +for (i =0 ; i < count; i++) + od->sorted[i].name_off = name_offsets[od->sorted[i].name_off]; +free (name_offsets); + +/* +* Match the eager loader's ordering: fill zero-sized ranges before +* choosing among equal-start aliases, so the size preference sees +* the same synthesized lengths as symbols__fixup_duplicate(). +*/ +for (i =0 ; i < count; i++) { +u64 size = od->sorted[i].end;/* was st_size */ +
tools/perf/util/symbol-elf.c static int dso__process_kernel_symbol(struct dso *dso, struct map *map, · line 1860
Quoted 10 lines
tools/perf/util/symbol-elf.c +10
-0+if (size >0 ) + od->sorted[i].end = od->sorted[i].start + size; +else if (i +1 < count) + od->sorted[i].end = od->sorted[i +1 ].start; +else + od->sorted[i].end =roundup (od->sorted[i].start,4096 ) +4096 ; + } + +if (!symbol_conf.allow_aliases) { +u32 out =0 ;
I think we agreed to factor out this block of code.
Quoted 77 lines
tools/perf/util/symbol-elf.c +77
-0+ +for (i =0 ; i < count; i++) { +u32 best = i; +const char *na =NULL , *nb; +char *da =NULL , *db; +bool has_ifunc = od->sorted[i].type ==STT_GNU_IFUNC ; + + na =elf_strptr (elf, shdr.sh_link, + od->sorted[best].name_off); +if (na) { + da =dso__demangle_sym (dso,0 , na); +if (da) + na = da; + } + +for (j = i +1 ; j < count && + od->sorted[j].start == od->sorted[i].start; j++) { +int choice; + + has_ifunc |= od->sorted[j].type ==STT_GNU_IFUNC ; + nb =elf_strptr (elf, shdr.sh_link, + od->sorted[j].name_off); +if (!na || !nb) +continue ; + + db =dso__demangle_sym (dso,0 , nb); +if (db) + nb = db; + + choice =symbol__choose_best ( + od->sorted[best].end - + od->sorted[best].start, + od->sorted[best].type, + od->sorted[best].binding, na, + od->sorted[j].end - + od->sorted[j].start, + od->sorted[j].type, + od->sorted[j].binding, nb); +if (choice ==SYMBOL_B ) { + best = j; +free (da); + da = db; + na = nb; + }else { +free (db); + } + } + +free (da); + od->sorted[out++] = od->sorted[best]; +if (has_ifunc && od->sorted[out -1 ].type !=STT_GNU_IFUNC ) + od->sorted[out -1 ].flags |=SYM_IDX_FLAG_IFUNC_ALIAS ; + i = j -1 ;/* skip past all aliases of this start */ + } + +if (out < count) { +struct sym_idx *shrunk; + + shrunk =realloc (od->sorted, out *sizeof (*od->sorted)); +if (shrunk) { + od->sorted = shrunk; +symbol__unaccount_bytes ((od->nr_alloc - out) * +sizeof (*od->sorted)); + od->nr_alloc = out; + } + } + count = out; + } + +/* +* The interval binary search requires non-overlapping ranges. In +* the default deduplicated mode, prefer the symbol with the nearest +* preceding start when an ELF st_size overlaps the next symbol. +*/ +if (!symbol_conf.allow_aliases) { +for (i =0 ; i +1 < count; i++) { +if (od->sorted[i].end > od->sorted[i +1 ].start)
tools/perf/util/symbol-elf.c static int dso__process_kernel_symbol(struct dso *dso, struct map *map, · line 1947
Quoted 10 lines
tools/perf/util/symbol-elf.c +10
-0+ od->sorted[i].end = od->sorted[i +1 ].start; + } + } + +/* +* Keep an exact-path data DSO for the symbol source. This may differ +* from the runtime image (for example, split debuginfo), so using the +* primary DSO's data cache could read an unrelated string-table offset. +* The standard DSO data cache manages descriptor eviction and reopening. +*/
Yes, it's a known problem and I hope to address it soon. Can you please make the path handling a separate commit? I think it's an independent fix for split debuginfo.
Quoted 42 lines
tools/perf/util/symbol-elf.c +42
-0+ od->data_dso =dso__new (syms_ss->name); +if (!od->data_dso || +dso__data_set_path (od->data_dso, syms_ss->name) <0 ) + goto out_decline_source; +dso__set_binary_type (od->data_dso,DSO_BINARY_TYPE__SYSTEM_PATH_DSO ); +dso__set_nsinfo (od->data_dso,nsinfo__get (dso__nsinfo (dso))); + +/* +* Open the managed source while eager fallback is still possible. +* A later failure would otherwise turn materialization into a miss. +*/ +if (od->sorted[0 ].name_off >= strshdr.sh_size) + goto out_decline_source; +if (check_add_overflow (strtab_offset, + (u64 )od->sorted[0 ].name_off, &probe_off)) + goto out_decline_source; +if (dso__data_read_offset (od->data_dso,NULL , probe_off, &probe,1 ) !=1 ) + goto out_decline_source; + + od->strtab_offset = strtab_offset; + od->strtab_size = strshdr.sh_size; + od->nr_sorted = count; + +dso__set_ondemand (dso, od); + +pr_debug ("%s: on-demand index: %u symbols (%zu bytes, %zu bytes total) budget=%zu\n" , +dso__long_name (dso), count, + od->nr_alloc *sizeof (*od->sorted),symbol__bytes_used (), + reservation_peak); + +return 1 ; + +out_decline_source: +if (od->data_dso) { +dso__data_close (od->data_dso); +dso__put (od->data_dso); + } +symbol__unaccount_bytes (od->nr_alloc *sizeof (*od->sorted)); +free (od->sorted); +free (od); +return 0 ; +}
[SNIP]
Quoted 94 lines
tools/perf/util/symbol.c +20
-21@@ -143,72 +143,80 @@ int __weak arch__compare_symbol_names_n(const char *namea, const char *nameb,return strncmp (namea, nameb, n); } -int __weak arch__choose_best_symbol (struct symbol *syma, -struct symbol *symb__maybe_unused ) +int __weak arch__choose_best_symbol (const char *syma_name) {/* Avoid "SyS" kernel syscall aliases */ -if (strlen (syma->name) >=3 && !strncmp (syma->name,"SyS" ,3 )) +if (strlen (syma_name) >=3 && !strncmp (syma_name,"SyS" ,3 ))return SYMBOL_B ; -if (strlen (syma->name) >=10 && !strncmp (syma->name,"compat_SyS" ,10 )) +if (strlen (syma_name) >=10 && !strncmp (syma_name,"compat_SyS" ,10 ))return SYMBOL_B ;return SYMBOL_A ; } -static int choose_best_symbol (struct symbol *syma,struct symbol *symb) +int symbol__choose_best (u64 a_size,u8 a_type,u8 a_binding, +const char *a_name, +u64 b_size,u8 b_type,u8 b_binding, +const char *b_name) {s64 a;s64 b;size_t na, nb;/* Prefer a symbol with non zero length */ - a = syma->end - syma->start; - b = symb->end - symb->start; -if ((b ==0 ) && (a >0 )) +if ((b_size ==0 ) && (a_size >0 ))return SYMBOL_A ; -else if ((a ==0 ) && (b >0 )) +else if ((a_size ==0 ) && (b_size >0 ))return SYMBOL_B ; -if (symbol__type (syma) !=symbol__type (symb)) { -if (symbol__type (syma) ==STT_NOTYPE ) +if (a_type != b_type) { +if (a_type ==STT_NOTYPE )return SYMBOL_B ; -if (symbol__type (symb) ==STT_NOTYPE ) +if (b_type ==STT_NOTYPE )return SYMBOL_A ; }/* Prefer a non weak symbol over a weak one */ - a =symbol__binding (syma) ==STB_WEAK ; - b =symbol__binding (symb) ==STB_WEAK ; + a = a_binding ==STB_WEAK ; + b = b_binding ==STB_WEAK ;if (b && !a)return SYMBOL_A ;if (a && !b)return SYMBOL_B ;/* Prefer a global symbol over a non global one */ - a =symbol__binding (syma) ==STB_GLOBAL ; - b =symbol__binding (symb) ==STB_GLOBAL ; + a = a_binding ==STB_GLOBAL ; + b = b_binding ==STB_GLOBAL ;if (a && !b)return SYMBOL_A ;if (b && !a)return SYMBOL_B ;/* Prefer a symbol with less underscores */ - a =prefix_underscores_count (syma->name); - b =prefix_underscores_count (symb->name); + a =prefix_underscores_count (a_name); + b =prefix_underscores_count (b_name);if (b > a)return SYMBOL_A ;else if (a > b)return SYMBOL_B ;/* Choose the symbol with the longest name */ - na =strlen (syma->name); - nb =strlen (symb->name); + na =strlen (a_name); + nb =strlen (b_name);if (na > nb)return SYMBOL_A ;else if (na < nb)return SYMBOL_B ; -return arch__choose_best_symbol (syma, symb);
tools/perf/util/symbol.c int __weak arch__compare_symbol_names_n(const char *namea, const char *nameb, · line 220
Quoted 10 lines
tools/perf/util/symbol.c +9
-0+return arch__choose_best_symbol (a_name); +} + +static int choose_best_symbol (struct symbol *syma,struct symbol *symb) +{ +return symbol__choose_best (syma->end - syma->start, +symbol__type (syma),symbol__binding (syma), syma->name, + symb->end - symb->start, +symbol__type (symb),symbol__binding (symb), symb->name); }
To reduce the size of the patch, I think it's better to split this as a separate commit. Please consider minimize the patch size in general to help reviewers. :)
Thanks,
Namhyung
Quoted 63 lines
tools/perf/util/symbol.c +8
-0void symbols__fixup_duplicate (struct rb_root_cached *symbols)@@ -1989,11 +1997,19 @@ int dso__load(struct dso *dso, struct map *map) }#ifdef HAVE_LIBBFD_SUPPORT +#ifdef HAVE_LIBELF_SUPPORT +if (is_reg && !symbol_conf.lazy_load_symbols) +#else if (is_reg) +#endif bfdrc =dso__load_bfd_symbols (dso, name);#endif if (is_reg && bfdrc <0 ) sirc =symsrc__init (ss, dso, name, symtab_type); +#if defined(HAVE_LIBBFD_SUPPORT ) && defined(HAVE_LIBELF_SUPPORT ) +if (is_reg && symbol_conf.lazy_load_symbols && sirc <0 ) + bfdrc =dso__load_bfd_symbols (dso, name); +#endif if (nsexit)nsinfo__mountns_enter (dso__nsinfo (dso), &nsc);tools/perf/util/symbol.h +5
-1@@ -233,6 +233,10 @@ size_t symbol__bytes_used(void);void symbol__account_bytes (size_t bytes);bool symbol__try_account_bytes (size_t bytes);void symbol__unaccount_bytes (size_t bytes); +int symbol__choose_best (u64 a_size,u8 a_type,u8 a_binding, +const char *a_name, +u64 b_size,u8 b_type,u8 b_binding, +const char *b_name); size_t __symbol__fprintf_symname_offs(const struct symbol *sym, const struct addr_location *al, bool unknown_as_addr,@@ -308,7 +312,7 @@ const char *arch__normalize_symbol_name(const char *name);int arch__compare_symbol_names (const char *namea,const char *nameb);int arch__compare_symbol_names_n (const char *namea,const char *nameb,unsigned int n); -int arch__choose_best_symbol (struct symbol *syma,struct symbol *symb); +int arch__choose_best_symbol (const char *syma_name);enum symbol_tag_include {SYMBOL_TAG_INCLUDE__NONE =0 ,tools/perf/util/symbol_conf.h +1
-0@@ -74,6 +74,7 @@ struct symbol_conf { no_buildid_mmap2, guest_code, lazy_load_kernel_maps, + lazy_load_symbols, keep_exited_threads, annotate_data_member, annotate_data_sample,Signature · 2 lines
-- Git-157)
Re: [PATCH v2 3/4] perf script: Add --lazy-load-symbols for lazy symbol loading
Quoted 6 lines
tools/perf/util/symbol-elf.c static int dso__process_kernel_symbol(struct dso *dso, struct map *map, · line 1860
Quoted 3 lines
tools/perf/util/symbol-elf.c +3
-0+ +if (!symbol_conf.allow_aliases) { +u32 out =0 ;I think we agreed to factor out this block of code.
You’re right. I interpreted the earlier request too narrowly and only factored out the pairwise selection policy into symbol__choose_best(). I’ll factor out the complete block in v3.
Quoted 8 lines
tools/perf/util/symbol-elf.c static int dso__process_kernel_symbol(struct dso *dso, struct map *map, · line 1947
Quoted 7 lines
tools/perf/util/symbol-elf.c +7
-0+ +/* +* Keep an exact-path data DSO for the symbol source. This may differ +* from the runtime image (for example, split debuginfo), so using the +* primary DSO's data cache could read an unrelated string-table offset. +* The standard DSO data cache manages descriptor eviction and reopening. +*/
Quoted 4 lines
Yes, it's a known problem and I hope to address it soon. Can you please make the path handling a separate commit? I think it's an independent fix for split debuginfo.
Ack. I’ll split the exact-path DSO data-cache support into a separate split-debuginfo fix and have the lazy-loading patch build on top of it in v3.
Quoted 12 lines
tools/perf/util/symbol.c int __weak arch__compare_symbol_names_n(const char *namea, const char *nameb, · line 220
Quoted 7 lines
tools/perf/util/symbol.c +6
-0+static int choose_best_symbol (struct symbol *syma,struct symbol *symb) +{ +return symbol__choose_best (syma->end - syma->start, +symbol__type (syma),symbol__binding (syma), syma->name, + symb->end - symb->start, +symbol__type (symb),symbol__binding (symb), symb->name); }To reduce the size of the patch, I think it's better to split this as a separate commit. Please consider minimize the patch size in general to help reviewers. :)
Ack. I’ll move the shared duplicate-selection refactoring into a separate preparatory commit to keep the lazy-loading patch smaller in v3.
PATCH v2 4/4 perf test: Test lazy symbol loading and symbol memory limits
In reply to Alireza HaghdoostAdd a perf script shell test for --lazy-load-symbols and --max-symbol-bytes.
Record a small callchain fixture, require evidence that the controlled perf DSO built an on-demand index, and compare only extracted occurrences of the controlled test_loop symbol. This avoids coupling the test to addresses, diagnostics, or architecture-specific symbols for which the eager and lazy loaders have documented differences.
Derive the constrained lazy budget from the unlimited run's index-reservation peak. This gives a deterministic boundary where the index fits and later materialization reaches the limit. Also verify eager limiting, malformed size rejection, and one-time warning behavior.
Report unsupported recording, missing controlled output, unavailable libelf, and unavailable dependent data as skips without replacing a prior failure. Keep helper returns safe under set -e. Add focused coverage for skip-status preservation and truncated string-table reads in the lazy materialization path.
--- tools/perf/tests/shell/script_lazy_load_symbols.sh | 278 +++++++++++++++++++++ .../tests/shell/script_lazy_load_symbols_skip.sh | 26 ++ tools/perf/tests/symbol-bytes.c | 58 +++++ 3 files changed, 362 insertions(+)
tools/perf/tests/shell/script_lazy_load_symbols.sh new file +278 -0
@@ -0,0 +1,278 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# perf script lazy symbol loading tests (exclusive) +# +# Verifies that --lazy-load-symbols matches the default eager loader for a +# controlled symbol, and that --max-symbol-bytes caps symbol allocations +# (emitting [unknown] plus a warning) without crashing. + +mark_skip() { + if [ "${err}" -eq 0 ]; then + err=2 + fi + return 0 +} + +if [ "${PERF_LAZY_LOAD_SYMBOLS_TEST_HELPERS:-}" = 1 ]; then + return 0 +fi + +set -e + +shelldir=$(dirname "$0") +# shellcheck source=lib/perf_has_symbol.sh +. "${shelldir}"/lib/perf_has_symbol.sh + +testsym="test_loop" +perf_path=$(readlink -f "$(command -v perf)") +lazy_index_budget= + +skip_test_missing_symbol ${testsym} + +if ! perf check feature -q libelf +then + echo "Lazy symbol loading [Skipped no libelf support]" + exit 2 +fi + +err=0 +temp_dir=$(mktemp -d /tmp/__perf_test.lazy_load.XXXXX) +perfdata="${temp_dir}/perf.data" +eager_out="${temp_dir}/eager.out" +lazy_out="${temp_dir}/lazy.out" +lazy_err="${temp_dir}/lazy.err" +eager_sym_out="${temp_dir}/eager.sym.out" +lazy_sym_out="${temp_dir}/lazy.sym.out" + +cleanup() { + rm -rf "${temp_dir}" + trap - EXIT TERM INT +} + +trap_cleanup() { + echo "Unexpected signal in ${FUNCNAME[1]}" + cleanup + exit 1 +} +trap trap_cleanup EXIT TERM INT + +test_lazy_load_identical() { + echo "Lazy-load output matches eager loader" + + # Record a small profile with callchains so symbol resolution runs. + if ! perf record -o "${perfdata}" -g -- perf test -w thloop 2> /dev/null + then + echo "Lazy-load identical [Skipped record not supported]" + mark_skip + return 0 + fi + + if ! perf script -i "${perfdata}" 2> /dev/null > "${eager_out}" || \ + ! perf script -v --lazy-load-symbols -i "${perfdata}" \ + 2> "${lazy_err}" > "${lazy_out}" + then + echo "Lazy-load identical [Failed perf script error]" + err=1 + return + fi + if ! grep -q "on-demand index:" "${lazy_err}" + then + echo "Lazy-load identical [Failed lazy loader fell back to eager]" + err=1 + return + fi + lazy_index_budget=$(awk -v dso="${perf_path}: on-demand index:" \ + 'index($0, dso) { sub(/^.* budget=/, ""); print; exit }' \ + "${lazy_err}") + case "${lazy_index_budget}" in + ''|*[!0-9]*) + echo "Lazy-load identical [Failed controlled DSO has no index]" + err=1 + return + ;; + esac + + # The comparison is only meaningful if something actually resolved; + # two all-[unknown] outputs would also match. + if ! grep -q "${testsym}" "${eager_out}" + then + echo "Lazy-load identical [Skipped no ${testsym} resolved]" + mark_skip + return 0 + fi + + grep -w -o "${testsym}" "${eager_out}" > "${eager_sym_out}" + if ! grep -w -o "${testsym}" "${lazy_out}" > "${lazy_sym_out}" + then + echo "Lazy-load identical [Failed no lazy ${testsym} resolved]" + err=1 + return + fi + + if ! cmp -s "${eager_sym_out}" "${lazy_sym_out}" + then + echo "Lazy-load identical [Failed ${testsym} output differs]" + err=1 + return + fi + echo "Lazy-load identical [Success]" +} + +test_max_symbol_bytes() { + echo "--max-symbol-bytes budget enforcement" + + # Depends on ${perfdata} from test_lazy_load_identical. + if [ ! -s "${perfdata}" ] + then + echo "--max-symbol-bytes budget [Skipped record not supported]" + mark_skip + return 0 + fi + + # A tiny budget forces most symbols to be dropped as [unknown], + # with a single warning, and must not crash. + if ! perf script --max-symbol-bytes=1K -i "${perfdata}" > /dev/null \ + 2> "${temp_dir}/budget.err" + then + echo "--max-symbol-bytes budget [Failed nonzero exit]" + err=1 + return + fi + if ! grep -q "symbol memory budget exceeded" "${temp_dir}/budget.err" + then + echo "--max-symbol-bytes budget [Failed missing warning]" + err=1 + return + fi + if perf script --max-symbol-bytes=1Kjunk -i "${perfdata}" \ + > /dev/null 2>&1 + then + echo "--max-symbol-bytes budget [Failed malformed size accepted]" + err=1 + return + fi + if ! perf script --max-symbol-bytes=0 -i "${perfdata}" \ + > /dev/null 2>&1 + then + echo "--max-symbol-bytes budget [Failed zero not accepted]" + err=1 + return + fi + + # The unlimited run logged the peak accounted bytes at the controlled + # DSO's index reservation, before alias dedup may have released bytes. + # Reuse that peak as the budget: deterministic index construction fits, + # while subsequent materialization must hit the limit. + if ! perf script -v --lazy-load-symbols \ + --max-symbol-bytes="${lazy_index_budget}B" \ + -i "${perfdata}" > /dev/null 2> "${temp_dir}/lazy-budget.err" + then + echo "--max-symbol-bytes lazy budget [Failed nonzero exit]" + err=1 + return + fi + if ! grep -Fq "${perf_path}: on-demand index:" \ + "${temp_dir}/lazy-budget.err" || + ! grep -q "symbol memory budget exceeded" "${temp_dir}/lazy-budget.err" + then + echo "--max-symbol-bytes lazy budget [Failed no indexed budget case]" + err=1 + return + fi + warnings=$(grep -c "symbol memory budget exceeded" \ + "${temp_dir}/lazy-budget.err" || true) + if [ "${warnings}" -ne 1 ] + then + echo "--max-symbol-bytes lazy budget [Failed warning count: ${warnings}]" + err=1 + return + fi + echo "--max-symbol-bytes budget [Success]" +} + +test_budget_truncation_range() { + local longsym + local first_symbol + local trunc_source="${temp_dir}/truncation.S" + local trunc_binary="${temp_dir}/truncation" + local trunc_data="${temp_dir}/truncation.data" + local trunc_out="${temp_dir}/truncation.out" + local trunc_err="${temp_dir}/truncation.err" + + echo "--max-symbol-bytes truncation range" + + if [ "$(uname -m)" != x86_64 ]; then + echo "--max-symbol-bytes truncation range [Skipped x86_64 only]" + mark_skip + return 0 + fi + + longsym=$(printf 's%.0s' {1..900}) + cat > "${trunc_source}" <<EOF + .text + .globl ${longsym} + .type ${longsym}, @function +${longsym}: + call omitted_symbol + mov \$60, %eax + xor %edi, %edi + syscall + + .globl omitted_symbol + .type omitted_symbol, @function +omitted_symbol: + mov \$500000000, %ecx +1: + dec %ecx + jnz 1b + ret + .size omitted_symbol, .-omitted_symbol +EOF + if ! cc -nostdlib -no-pie -Wl,--build-id=none -Wl,-e,"${longsym}" \ + -o "${trunc_binary}" "${trunc_source}" + then + echo "--max-symbol-bytes truncation range [Skipped compiler unsupported]" + mark_skip + return 0 + fi + + first_symbol=$(readelf -W -s "${trunc_binary}" | + awk '$4 == "FUNC" && $7 != "UND" { print $8; exit }') + if [ "${first_symbol}" != "${longsym}" ]; then + echo "--max-symbol-bytes truncation range [Skipped unexpected symbol order]" + mark_skip + return 0 + fi + + if ! perf record -o "${trunc_data}" -e cycles:u -F 1000 -- \ + "${trunc_binary}" 2> /dev/null + then + echo "--max-symbol-bytes truncation range [Skipped record not supported]" + mark_skip + return 0 + fi + if ! perf script --max-symbol-bytes=1K -i "${trunc_data}" -F ip,sym,dso \ + > "${trunc_out}" 2> "${trunc_err}" + then + echo "--max-symbol-bytes truncation range [Failed perf script error]" + err=1 + return + fi + + if ! grep -q "symbol memory budget exceeded" "${trunc_err}" || + ! grep -F "${trunc_binary}" "${trunc_out}" | grep -q '\[unknown\]' || + grep -Fq "${longsym}" "${trunc_out}" + then + echo "--max-symbol-bytes truncation range [Failed omitted range resolved]" + err=1 + return + fi + echo "--max-symbol-bytes truncation range [Success]" +} + +test_lazy_load_identical +test_max_symbol_bytes +test_budget_truncation_range + +cleanup +exit $err
tools/perf/tests/shell/script_lazy_load_symbols_skip.sh new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# perf script lazy symbol loading skip status + +set -e + +shelldir=$(dirname "$0") +PERF_LAZY_LOAD_SYMBOLS_TEST_HELPERS=1 +. "${shelldir}"/script_lazy_load_symbols.sh +unset PERF_LAZY_LOAD_SYMBOLS_TEST_HELPERS + +err=0 +mark_skip +if [ "${err}" -ne 2 ]; then + echo "Lazy-load skip status [Failed expected 2, got ${err}]" + exit 1 +fi + +err=1 +mark_skip +if [ "${err}" -ne 1 ]; then + echo "Lazy-load skip status [Failed skip overwrote failure: ${err}]" + exit 1 +fi + +echo "Lazy-load skip status [Success]"
tools/perf/tests/symbol-bytes.c +58 -0
70 lines not on this page · raw message
Signature · 1 line
Git-157)
[email protected]
AI reviewRe: [PATCH v2 4/4] perf test: Test lazy symbol loading and symbol memory limits
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 16 lines
From: Alireza Haghdoost <[email protected]>
Add a perf script shell test for --lazy-load-symbols and --max-symbol-bytes.
Record a small callchain fixture, require evidence that the controlled perf DSO built an on-demand index, and compare only extracted occurrences of the controlled
test_loopsymbol. This avoids coupling the test to addresses, diagnostics, or architecture-specific symbols for which the eager and lazy loaders have documented differences.Derive the constrained lazy budget from the unlimited run's index-reservation peak. This gives a deterministic boundary where the index fits and later materialization reaches the limit. Also verify eager limiting, malformed size rejection, and one-time warning behavior.
Quoted 7 lines
Report unsupported recording, missing controlled output, unavailable libelf, and unavailable dependent data as skips without replacing a prior failure. Keep helper returns safe under set -e. Add focused coverage for skip-status preservation and truncated string-table reads in the lazy materialization path.
Signed-off-by Alireza Haghdoost <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4