Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Usama Arif" <usama.arif@linux.dev>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/2] perf/x86/amd/uncore: Remove redundant event slot scan
Date: Mon, 21 Sep 2026 15:36:46 +0000	[thread overview]
Message-ID: <20260921153646.D18101F008A7@smtp.kernel.org> (raw)
In-Reply-To: <20260921153108.2713179-2-usama.arif@linux.dev>

> amd_uncore_add() first checks the slot recorded in event->hw.idx. If
> that misses, it scans ctx->events[] for the event before looking for a
> free slot.
> 
> Perf serializes ->add() and ->del() for an event. Initialization sets
> idx to -1. A successful ->add() claims a slot and records its index
> before returning, while ->del() clears the slot before resetting idx.
> CPU context migration follows the same delete/add sequence.
> 
> Thus an installed event can only reside at the recorded index. If the
> direct check misses, the event is not present in ctx->events[].
> 
> Remove the redundant scan. This avoids walking all counters before each
> new slot search after multiplexing has scheduled an event out.
> 
> On a host running a production workload in the Meta fleet, amd_uncore_add()
> was called 56,575 times per second from mux rotation. Its 16-counter DF PMU
> makes each failed search scan 16 pointers across two cache lines.
> 
> Cc: Sandipan Das <sandipan.das@amd.com>
> Signed-off-by: Usama Arif <usama.arif@linux.dev>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921153108.2713179-1-usama.arif@linux.dev?part=1


  reply	other threads:[~2026-09-21 15:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 15:30 [PATCH 0/2] perf/x86/amd/uncore: Drop redundant counter slot searches Usama Arif
2026-09-21 15:30 ` [PATCH 1/2] perf/x86/amd/uncore: Remove redundant event slot scan Usama Arif
2026-09-21 15:36   ` sashiko-bot [this message]
2026-09-21 15:30 ` [PATCH 2/2] perf/x86/amd/uncore: Free counter slot by index Usama Arif
2026-09-21 15:38   ` sashiko-bot
2026-09-23 10:38 ` [PATCH 0/2] perf/x86/amd/uncore: Drop redundant counter slot searches Sandipan Das

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=20260921153646.D18101F008A7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=usama.arif@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