Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alireza Haghdoost" <haghdoost@uber.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 4/6] perf script: Add --max-symbol-bytes to bound ELF symbol memory
Date: Fri, 25 Sep 2026 19:26:23 +0000	[thread overview]
Message-ID: <20260925192623.F29D81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260925-perf-symbol-memory-send-v3-4-3e4e234c363b@uber.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf: missing <string.h> inclusion for string functions
--

commit 79450839068bd1d9b33fd4d112e056707965c93e
Author: Alireza Haghdoost <haghdoost@uber.com>

perf script: Add --max-symbol-bytes to bound ELF symbol memory

This commit adds a --max-symbol-bytes option to perf script to bound the
memory footprint of struct symbol allocations on the ELF loader path. Once
the budget is exceeded, it stops loading symbols and leaves unresolved
addresses as [unknown].

> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 0174489d1c0fd..6c459ce6f433e 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
[ ... ]
> @@ -4110,6 +4111,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)
> +{
[ ... ]
> +	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]
Does this file need an explicit #include <string.h>?

The new parse_max_symbol_bytes() function relies on POSIX string functions 
(strcmp, strlen, strchr, strspn). To ensure build compatibility across standard
C libraries like musl, standard header files should be explicitly included
rather than relying on implicit inclusion from other headers.

> +		return -1;
> +
> +	bytes = parse_tag_value(str, size_tags);
> +	if (bytes != (unsigned long)-1) {
> +		*max_bytes = bytes;
> +		return 0;
> +	}
> +
> +	return -1;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925-perf-symbol-memory-send-v3-0-3e4e234c363b@uber.com?part=4

  reply	other threads:[~2026-09-25 19:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 19:09 [PATCH v3 0/6] perf script: Bounded and lazy symbol loading Alireza Haghdoost via B4 Relay
2026-09-25 19:09 ` [PATCH v3 1/6] perf symbols: Fix broken ELF_C_READ_MMAP fallback guard Alireza Haghdoost via B4 Relay
2026-09-25 19:21   ` sashiko-bot
2026-09-25 19:09 ` [PATCH v3 2/6] perf dso: Allow reading DSO data from an explicit file Alireza Haghdoost via B4 Relay
2026-09-25 19:26   ` sashiko-bot
2026-09-25 19:09 ` [PATCH v3 3/6] perf symbols: Factor out duplicate symbol selection Alireza Haghdoost via B4 Relay
2026-09-25 19:21   ` sashiko-bot
2026-09-25 19:40   ` Ian Rogers
2026-09-25 19:55     ` Alireza Haghdoost
2026-09-25 20:21       ` Ian Rogers
2026-09-25 19:09 ` [PATCH v3 4/6] perf script: Add --max-symbol-bytes to bound ELF symbol memory Alireza Haghdoost via B4 Relay
2026-09-25 19:26   ` sashiko-bot [this message]
2026-09-25 19:09 ` [PATCH v3 5/6] perf script: Add --lazy-load-symbols for lazy symbol loading Alireza Haghdoost via B4 Relay
2026-09-25 19:27   ` sashiko-bot
2026-09-25 19:09 ` [PATCH v3 6/6] perf test: Test lazy symbol loading and symbol memory limits Alireza Haghdoost via B4 Relay
2026-09-25 19:26   ` sashiko-bot
2026-09-25 20:20 ` [PATCH v3 0/6] perf script: Bounded and lazy symbol loading Ian Rogers
2026-09-25 21:28   ` Alireza Haghdoost
2026-09-25 21:55     ` Ian Rogers
2026-09-30 19:58       ` Alireza Haghdoost
2026-09-30 21:18         ` Ian Rogers

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=20260925192623.F29D81F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=haghdoost@uber.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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