diff options
| author | Peter Zijlstra (Intel) <peterz@infradead.org> | 2025-01-21 18:23:02 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-05-29 12:03:02 +0300 |
| commit | 887e39ac4704e2285dc3622e1ea40cd3130199d2 (patch) | |
| tree | d45d331aad9b61afb0f8ba97b8f8bf69573e3977 /include/linux | |
| parent | d402437cde36cce8e34f32a53322b3f60ca292d2 (diff) | |
| download | linux-887e39ac4704e2285dc3622e1ea40cd3130199d2.tar.xz | |
perf: Avoid the read if the count is already updated
[ Upstream commit 8ce939a0fa194939cc1f92dbd8bc1a7806e7d40a ]
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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/perf_event.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 0997077bcc52..ce64b4b937f0 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1063,7 +1063,13 @@ struct perf_output_handle { struct perf_buffer *rb; unsigned long wakeup; unsigned long size; - u64 aux_flags; + union { + u64 flags; /* perf_output*() */ + u64 aux_flags; /* perf_aux_output*() */ + struct { + u64 skip_read : 1; + }; + }; union { void *addr; unsigned long head; |
