All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 1/4] perf threads: Don't resurrect removed threads in last_match
Date: Wed, 18 Nov 2026 08:03:49 +0000	[thread overview]
Message-ID: <sashiko-outbox-220410@kernel.org> (raw)
In-Reply-To: <20261118075516.1278903-2-irogers@google.com>

> threads__find() looks up the thread under down_read(&table->lock), drops
> the read lock, and then acquires down_write(&table->lock) inside
> threads_table_entry__set_last_match() to update table->last_match.
> 
> If threads__remove() (or threads__remove_all_threads()) runs in the
> window between up_read(&table->lock) and down_write(&table->lock), it
> clears table->last_match and deletes the thread from table->shard, only
> for threads__find() to overwrite table->last_match with the removed
> thread. Subsequent lookups for that tid then return the removed thread
> from table->last_match, causing stale event attribution and keeping a
> cached reference until another lookup evicts it. In addition,
> threads__find() unnecessarily took down_write(&table->lock) to re-set
> table->last_match even when last_match already hit.
> 
> Only update table->last_match on a cache miss, and recheck under
> down_write(&table->lock) that tid still maps to the same struct thread
> in table->shard before updating table->last_match.
> 
> Fixes: d436f90a64f3 ("perf machine: Move machine's threads into its own abstraction")
> Signed-off-by: Ian Rogers <irogers@google.com>

Sashiko has reviewed this patch and found no issues.

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


  reply	other threads:[~2026-11-18  8:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  7:55 [PATCH v1 0/4] perf tools: Fix thread cache race, stat per-pkg delta bug, and memory leaks Ian Rogers
2026-11-18  7:55 ` [PATCH v1 1/4] perf threads: Don't resurrect removed threads in last_match Ian Rogers
2026-11-18  8:03   ` sashiko-bot [this message]
2026-11-18  7:55 ` [PATCH v1 2/4] perf stat: Don't corrupt zero or prev_raw_counts on skipped per-pkg CPUs Ian Rogers
2026-11-18  7:55 ` [PATCH v1 3/4] perf metricgroup: Fix realloc() leaks in resolve_metric() and __add_metric() Ian Rogers
2026-11-18  7:58   ` sashiko-bot
2026-11-18  7:55 ` [PATCH v1 4/4] perf pmu: Free alias on error paths in perf_pmu__new_alias() Ian Rogers
2026-11-18  7:59   ` 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-220410@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 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.