diff options
| author | Usama Arif <usama.arif@linux.dev> | 2026-09-21 08:30:14 -0700 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-09-25 12:45:54 +0200 |
| commit | 4a8557a4e5d2d5f96a989a428e38569451e74405 (patch) | |
| tree | 287928abfe61ad309834396bf019bec9217abe19 /tools/perf/scripts/python | |
| parent | ba29babd881e09a7bb8b01fcfeda3d637d8115c5 (diff) | |
perf/x86/amd/uncore: Remove redundant event slot scan
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.
Signed-off-by: Usama Arif <usama.arif@linux.dev>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Sandipan Das <sandipan.das@amd.com>
Link: https://patch.msgid.link/20260921153108.2713179-2-usama.arif@linux.dev
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
