aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events/ring_buffer.c
diff options
context:
space:
mode:
authorPeter Zijlstra (Intel) <peterz@infradead.org>2025-01-21 07:23:02 -0800
committerPeter Zijlstra <peterz@infradead.org>2025-02-05 10:29:45 +0100
commit8ce939a0fa194939cc1f92dbd8bc1a7806e7d40a (patch)
tree68046b67ba49a0feb3c687e5831c9e39b263b4e3 /kernel/events/ring_buffer.c
parentperf/x86/intel: Avoid disable PMU if !cpuc->enabled in sample read (diff)
downloadlinux-8ce939a0fa194939cc1f92dbd8bc1a7806e7d40a.tar.gz
linux-8ce939a0fa194939cc1f92dbd8bc1a7806e7d40a.zip
perf: Avoid the read if the count is already updated
The event may have been updated in the PMU-specific implementation, e.g., Intel PEBS counters snapshotting. The common code should not read and overwrite the value. The PERF_SAMPLE_READ in the data->sample_type can be used to detect whether the PMU-specific value is available. If yes, avoid the pmu->read() in the common code. Add a new flag, skip_read, to track the case. Factor out a perf_pmu_read() to clean up the code. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20250121152303.3128733-3-kan.liang@linux.intel.com
Diffstat (limited to 'kernel/events/ring_buffer.c')
-rw-r--r--kernel/events/ring_buffer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 180509132d4b..59a52b1a1f78 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -185,6 +185,7 @@ __perf_output_begin(struct perf_output_handle *handle,
handle->rb = rb;
handle->event = event;
+ handle->flags = 0;
have_lost = local_read(&rb->lost);
if (unlikely(have_lost)) {