All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hui Su" <sh_def@163.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf thread_map: Deduplicate numerically equivalent PID and TID strings
Date: Sat, 12 Sep 2026 03:20:12 +0000	[thread overview]
Message-ID: <20260912032013.2E7241F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912031112.1814574-2-sh_def@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing explicit inclusion of <stdio.h> for snprintf.
--

commit b1526ce24c053489c0a3385a95c4492a0906a746
Author: Hui Su <sh_def@163.com>

perf thread_map: Deduplicate numerically equivalent PID and TID strings

This commit replaces the ineffective prev_pid and prev_tid checks with an
intlist seen-set to correctly deduplicate numerically equivalent PID and TID
strings. It also adds new test cases to verify this behavior.

> diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c
> index 877868107455e..0299c8fd0a6a9 100644
> --- a/tools/perf/tests/thread-map.c
> +++ b/tools/perf/tests/thread-map.c
> @@ -56,6 +56,39 @@ static int test__thread_map(struct test_suite *test __maybe_unused, int subtest

[ ... ]

> +	/* test numeric deduplication of PIDs */
> +	{
> +		struct perf_thread_map *base, *dup;
> +		char pid_str[64];
> +
> +		base = thread_map__new_by_pid(getpid());
> +		TEST_ASSERT_VAL("failed to alloc baseline map", base);
> +
> +		snprintf(pid_str, sizeof(pid_str), "%d,0%d", getpid(), getpid());

[Severity: Low]
Does test__thread_map() in tools/perf/tests/thread-map.c need an explicit
include of <stdio.h> for snprintf?

The global review guidelines mandate explicit inclusion of POSIX standard
headers for all libc functions to ensure musl libc compatibility, preventing
reliance on implicit inclusion. Since this introduces a new call to snprintf,
strict libc implementations like musl may fail to compile without the direct
header inclusion.

> +
> +		dup = thread_map__new_str(pid_str, NULL, false);
> +		TEST_ASSERT_VAL("failed to alloc duplicate pid map", dup);
> +		TEST_ASSERT_VAL("wrong nr for duplicate PIDs",
> +				dup->nr == base->nr);
> +
> +		perf_thread_map__put(dup);
> +		perf_thread_map__put(base);
> +	}
> +
>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912031112.1814574-2-sh_def@163.com?part=1

  reply	other threads:[~2026-09-12  3:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12  3:11 [PATCH] perf thread_map: Deduplicate numerically equivalent PID and TID strings Hui Su
2026-09-12  3:20 ` sashiko-bot [this message]
2026-09-12  5:17 ` [PATCH v2] " Hui Su
2026-09-12  5:26   ` sashiko-bot

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=20260912032013.2E7241F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sh_def@163.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.