summaryrefslogtreecommitdiff
path: root/include/linux/perf_event.h
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2022-09-21 15:00:31 -0700
committerPeter Zijlstra <peterz@infradead.org>2022-09-27 22:50:24 +0200
commit7b084630153152239d84990ac4540c2dd360186f (patch)
tree1a4f811f91b4843ca55bd2c5c5af57a4aa668430 /include/linux/perf_event.h
parentdca6344d7a77dd0501a73745f4a9fb1ee2bc9d7c (diff)
perf: Use sample_flags for addr
Use the new sample_flags to indicate whether the addr field is filled by the PMU driver. As most PMU drivers pass 0, it can set the flag only if it has a non-zero value. And use 0 in perf_sample_output() if it's not filled already. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20220921220032.2858517-1-namhyung@kernel.org
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r--include/linux/perf_event.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 368bdc4f563f..f4a13579b0e8 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1028,7 +1028,6 @@ struct perf_sample_data {
* minimize the cachelines touched.
*/
u64 sample_flags;
- u64 addr;
struct perf_raw_record *raw;
u64 period;
@@ -1040,6 +1039,7 @@ struct perf_sample_data {
union perf_sample_weight weight;
union perf_mem_data_src data_src;
u64 txn;
+ u64 addr;
u64 type;
u64 ip;
@@ -1079,9 +1079,13 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
{
/* remaining struct members initialized in perf_prepare_sample() */
data->sample_flags = 0;
- data->addr = addr;
data->raw = NULL;
data->period = period;
+
+ if (addr) {
+ data->addr = addr;
+ data->sample_flags |= PERF_SAMPLE_ADDR;
+ }
}
/*