Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v4 7/7] perf test: Add test comparing PROCMAP_QUERY and /proc/pid/maps synthesis
Date: Fri, 04 Dec 2026 21:16:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-250685@kernel.org> (raw)
In-Reply-To: <20261204205854.3973609-8-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf test: synthesize() repeats kernel map creation via
  machine__new_host()
--

commit 70b9ba90450d60910ea0fb4eb9c493ae0b385cd3
Author: Ian Rogers <irogers@google.com>

perf test: Add test comparing PROCMAP_QUERY and /proc/pid/maps synthesis

This commit adds a perf test that synthesizes MMAP2 events for the test
process using both /proc/<pid>/maps and the PROCMAP_QUERY ioctl and checks
that the resulting events match byte for byte.

> diff --git a/tools/perf/tests/synthesize-mmap.c b/tools/perf/tests/synthesize-mmap.c
> new file mode 100644
> index 0000000000000..514856ed6abee
> --- /dev/null
> +++ b/tools/perf/tests/synthesize-mmap.c

[ ... ]

> +static int synthesize(struct synth_events *se, bool procmap_query, bool mmap_data,
> +		      int fill)
> +{
> +	bool saved_procmap_query = synthesize_procmap_query;
> +	struct perf_env host_env;
> +	struct machine *machine;
> +	union perf_event *event;
> +	int err = -1;
> +
> +	perf_tool__init(&se->tool, /*ordered_events=*/false);
> +	/* Use a new machine so DSO build ID caches aren't shared. */
> +	perf_env__init(&host_env);
> +	machine = machine__new_host(&host_env);

[Severity: Low]
Does synthesize() need machine__new_host() here?

test__synthesize_procmap_query() calls synthesize() 8 times, and each
machine__new_host() call runs machine__create_kernel_maps().  That parses
/proc/modules, recursively walks /lib/modules/<release>/, and scans
/proc/kallsyms on every run, even though kernel maps are never used here.

Initializing a local struct machine with machine__init(&machine, "",
HOST_KERNEL_ID) and cleaning up with machine__exit(&machine) avoids all
8 kernel-map setups and the host_env initialization.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204205854.3973609-1-irogers@google.com?part=7

  reply	other threads:[~2026-12-04 21:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 20:58 [PATCH v4 0/7] perf synthetic-events: Use PROCMAP_QUERY for mmap synthesis Ian Rogers
2026-12-04 20:58 ` [PATCH v4 1/7] perf machine: Fix leak when creating host kernel maps fails Ian Rogers
2026-12-04 20:58 ` [PATCH v4 2/7] perf synthetic-events: Fix race on DSO build IDs when synthesizing Ian Rogers
2026-12-04 20:58 ` [PATCH v4 3/7] perf bench synthesize: Initialize symbols so build IDs can be read Ian Rogers
2026-12-04 20:58 ` [PATCH v4 4/7] tools headers UAPI: Synchronize linux/fs.h with the kernel sources Ian Rogers
2026-12-04 20:58 ` [PATCH v4 5/7] perf synthetic-events: Use PROCMAP_QUERY to synthesize mmap events Ian Rogers
2026-12-04 20:58 ` [PATCH v4 6/7] perf bench synthesize: Add --procmap-query option Ian Rogers
2026-12-04 20:58 ` [PATCH v4 7/7] perf test: Add test comparing PROCMAP_QUERY and /proc/pid/maps synthesis Ian Rogers
2026-12-04 21:16   ` sashiko-bot [this message]
2026-12-04 21:16 ` [PATCH v4 0/7] perf synthetic-events: Use PROCMAP_QUERY for mmap synthesis 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=sashiko-outbox-250685@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.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