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 v3 5/7] perf synthetic-events: Use PROCMAP_QUERY to synthesize mmap events
Date: Fri, 04 Dec 2026 06:46:37 +0000	[thread overview]
Message-ID: <sashiko-outbox-249245@kernel.org> (raw)
In-Reply-To: <20261204062328.2508164-6-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] perf: PROCMAP_QUERY enabled on 6.11-6.18 without build ID or
  VMA locks
--

commit 22c6077b6804349c8a83a045b52a96cac3269331
Author: Ian Rogers <irogers@google.com>

perf synthetic-events: Use PROCMAP_QUERY to synthesize mmap events

This commit uses the PROCMAP_QUERY ioctl on /proc/<pid>/task/<pid>/maps
to synthesize MMAP2 events and fetch kernel-provided build IDs on Linux
6.19+, falling back to reading the maps file as text when PROCMAP_QUERY
is unavailable.

Link: https://lore.kernel.org/lkml/20261202124341.GA677025@noisy.programming.kicks-ass.net/

> diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
> index 445199d7bbd46..fe2c36962d1d0 100644
> --- a/tools/perf/util/synthetic-events.c
> +++ b/tools/perf/util/synthetic-events.c
> @@ -498,134 +524,506 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
[ ... ]
> +	if (procmap_query__supported())
> +		rc = synth_mmap2_state__procmap_query(&state, fd);
> +
> +	if (rc > 0)
> +		rc = synth_mmap2_state__read_maps_text(&state, fd, bf, sizeof(bf));

[Severity: Medium]
Should synth_mmap2_state__procmap_query() be skipped when mmap_data is
true on Linux 6.11-6.18?

On those kernels, procmap_query__probe() leaves
procmap_query_build_id_supported false, so data-mmap synthesis (such as
perf record --call-graph dwarf) pays the per-VMA ioctl and two-pass scan
cost with no build-ID speedup, regressing both warm and cold DSO caches.

On Linux 6.17, PROCMAP_QUERY also regresses target mm->mmap_lock
contention for both exec-only and data-mmap synthesis.

Text /proc/<pid>/maps uses per-VMA locks since 5631da56c9a8
("fs/proc/task_mmu: read proc/pid/maps under per-vma lock"), whereas
PROCMAP_QUERY gained them in 6.18 via d9d1c2d81797 ("fs/proc/task_mmu:
execute PROCMAP_QUERY ioctl under per-vma locks").

Falling back to synth_mmap2_state__read_maps_text() when mmap_data is
true without procmap_query_build_id_supported (and on Linux 6.17) would
avoid these regressions while keeping the exec-only speedup on 6.11-6.16
and 6.18.

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

  reply	other threads:[~2026-12-04  6:46 UTC|newest]

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