mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sandipan Das <sandipan.das@amd.com>
To: Usama Arif <usama.arif@linux.dev>,
	acme@kernel.org, adrian.hunter@intel.com,
	alexander.shishkin@linux.intel.com, bp@alien8.de,
	dave.hansen@linux.intel.com, hpa@zytor.com, irogers@google.com,
	james.clark@linaro.org, jolsa@kernel.org,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	mark.rutland@arm.com, mingo@redhat.com, namhyung@kernel.org,
	peterz@infradead.org, tglx@kernel.org, x86@kernel.org
Cc: hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev,
	kernel-team@meta.com
Subject: Re: [PATCH 0/2] perf/x86/amd/uncore: Drop redundant counter slot searches
Date: Wed, 23 Sep 2026 16:08:45 +0530	[thread overview]
Message-ID: <1486211b-1182-4277-b273-bdc84f6d23d7@amd.com> (raw)
In-Reply-To: <20260921153108.2713179-1-usama.arif@linux.dev>

On 21-09-2026 21:00, Usama Arif wrote:
> Both amd_uncore_add() and amd_uncore_del() search ctx->events[] for an
> event whose counter slot is already recorded in event->hw.idx.
> 
> Perf serializes ->add() and ->del() for an event, and the driver never
> moves an installed event between slots, so an installed event can only
> be at the recorded index. Both searches are redundant.
> 
> Neither callback is normally hot. That changes once more events target
> a PMU than it has counters. Perf then multiplexes them: every mux tick
> deschedules the resident set and schedules the next one, so both callbacks
> run for each rotated event on every tick.
> 
> Meta's fleet-wide profiles attribute 1.1% of kernel CPU time, excluding
> do_idle(), to amd_uncore_add() and amd_uncore_del() combined. On the
> host that exposed this, a workload holding 15,782 perf event file
> descriptors drove 56,575 calls per second into each callback from mux
> rotation, against a 16-counter DF PMU.
> 
> Patch 1 removes the scan in amd_uncore_add(). It walks every counter
> before the free slot search, which is the common case once multiplexing
> has scheduled the event out.
> 
> Patch 2 makes amd_uncore_del() free the recorded slot directly instead
> of rescanning from slot zero. Deleting all events from a full PMU with
> N counters drops from N * (N + 1) / 2 compare-exchanges to N.
> 
> No functional change intended.
> 
> Usama Arif (2):
>   perf/x86/amd/uncore: Remove redundant event slot scan
>   perf/x86/amd/uncore: Free counter slot by index
> 
>  arch/x86/events/amd/uncore.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
> 

For the series

Reviewed-by: Sandipan Das <sandipan.das@amd.com>

      parent reply	other threads:[~2026-09-23 10:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 15:30 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:30 ` [PATCH 2/2] perf/x86/amd/uncore: Free counter slot by index Usama Arif
2026-09-23 10:38 ` Sandipan Das [this message]

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=1486211b-1182-4277-b273-bdc84f6d23d7@amd.com \
    --to=sandipan.das@amd.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=hpa@zytor.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=shakeel.butt@linux.dev \
    --cc=tglx@kernel.org \
    --cc=usama.arif@linux.dev \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®