From: sashiko-bot@kernel.org
To: "Namhyung Kim" <namhyung@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/4] perf annotate-data: Convert type histogram to hashmap
Date: Sat, 12 Sep 2026 05:56:45 +0000 [thread overview]
Message-ID: <20260912055646.034D81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912054706.1475583-2-namhyung@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing index increment when hashmap lookup fails in `get_member_overhead` causes histogram columns to be scrambled across events.
--
commit 4840a8fb0b1911e5130194633a0b05e4bf3e21fe
Author: Namhyung Kim <namhyung@kernel.org>
perf annotate-data: Convert type histogram to hashmap
This commit converts the type histogram from an array to a hashmap to
reduce memory overhead. It replaces direct array accesses with hashmap
lookups across the annotation components.
> diff --git a/tools/perf/ui/browsers/annotate-data.c b/tools/perf/ui/browsers/annotate-data.c
> index aa8c89fe2e82c..82667c6ae2e74 100644
> --- a/tools/perf/ui/browsers/annotate-data.c
> +++ b/tools/perf/ui/browsers/annotate-data.c
> @@ -62,12 +62,17 @@ static int get_member_overhead(struct annotated_data_type *adt,
>
> k = 0;
> for_each_group_evsel(evsel, leader) {
> + struct type_hist_entry *hist;
> +
> if (symbol_conf.skip_empty &&
> evsel__hists(evsel)->stats.nr_samples == 0)
> continue;
>
> - h = adt->histograms[evsel->core.idx];
> - update_hist_entry(&entry->hists[k++], &h->addr[offset]);
> + h = &adt->histograms[evsel->core.idx];
> + if (!hashmap__find(&h->samples, offset, &hist))
> + continue;
> +
> + update_hist_entry(&entry->hists[k++], hist);
[Severity: Medium]
When hashmap__find() fails (indicating an event has no samples at this byte
offset), the continue statement skips the k++ increment.
Will this cause subsequent events in the group to write their stats into the
skipped event's entry->hists[k] bucket?
If k is not advanced for the skipped event, it appears the histogram columns
for multi-event annotation data could shift and display in the wrong event
columns in the UI.
Could we ensure k is incremented even when the hashmap lookup fails to
preserve the correct column alignment?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260912054706.1475583-1-namhyung@kernel.org?part=1
next prev parent reply other threads:[~2026-09-12 5:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 5:47 [PATCH 0/4] perf annotate-data: Support flexible array types Namhyung Kim
2026-09-12 5:47 ` [PATCH 1/4] perf annotate-data: Convert type histogram to hashmap Namhyung Kim
2026-09-12 5:56 ` sashiko-bot [this message]
2026-09-12 5:47 ` [PATCH 2/4] perf dwarf-aux: Add die_has_flex_array() helper Namhyung Kim
2026-09-12 5:58 ` sashiko-bot
2026-09-12 5:47 ` [PATCH 3/4] perf annotate-date: Allow out-of-size access for flex-array types Namhyung Kim
2026-09-12 6:02 ` sashiko-bot
2026-09-12 5:47 ` [PATCH 4/4] perf annotate-data: Adjust type offset for flex-array Namhyung Kim
2026-09-12 5:57 ` 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=20260912055646.034D81F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@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 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.