Messages in this thread | | | Date | Thu, 22 Sep 2022 16:48:34 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH 1/2] perf: Use sample_flags for addr |
| |
On Wed, Sep 21, 2022 at 03:00:31PM -0700, Namhyung Kim wrote: > 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.
So no objection to the general idea; just a question
> 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;
Is there a reason you placed the variable where you did?
I'm thinking we should look at what perf-tool thinks is the common set of SAMPLE flags and make sure those fields are grouped in as little cachelines as possible.
Things like @ip and @type, which are basically *always* set, should definitely be on top, no?
| |