From: Namhyung Kim <namhyung@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Song Liu <songliubraving@fb.com>,
Ravi Bangoria <ravi.bangoria@amd.com>,
Stephane Eranian <eranian@google.com>,
Kan Liang <kan.liang@linux.intel.com>
Subject: [PATCH] perf: Change the layout of perf_sample_data
Date: Thu, 22 Sep 2022 13:55:50 -0700 [thread overview]
Message-ID: <20220922205550.3094090-1-namhyung@kernel.org> (raw)
In-Reply-To: <CAM9d7cgDTy96eeCAARufSKZJFMvAAo6QSLAoEQv_zUFD-Rf+Lw@mail.gmail.com>
With recent change, it can set fields only if it's actually used.
Change the data layout so that it can have commonly used fields together
in a cache line boundary. The main user (the perf tools) sets the
IP, TID, TIME, PERIOD always. Also group relevant fields like addr,
phys_addr and data_page_size.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
include/linux/perf_event.h | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index e9b151cde491..8c16dae6e6bb 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1023,25 +1023,13 @@ extern u64 perf_event_read_value(struct perf_event *event,
struct perf_sample_data {
- /*
- * Fields set by perf_sample_data_init(), group so as to
- * minimize the cachelines touched.
- */
u64 sample_flags;
u64 period;
-
+ u64 type;
/*
- * The other fields, optionally {set,used} by
- * perf_{prepare,output}_sample().
+ * Fields set commonly by perf tools, group so as to
+ * minimize the cachelines touched.
*/
- struct perf_branch_stack *br_stack;
- union perf_sample_weight weight;
- union perf_mem_data_src data_src;
- u64 txn;
- u64 addr;
- struct perf_raw_record *raw;
-
- u64 type;
u64 ip;
struct {
u32 pid;
@@ -1049,22 +1037,33 @@ struct perf_sample_data {
} tid_entry;
u64 time;
u64 id;
- u64 stream_id;
struct {
u32 cpu;
u32 reserved;
} cpu_entry;
+
+ /*
+ * The other fields, optionally {set,used} by
+ * perf_{prepare,output}_sample().
+ */
struct perf_callchain_entry *callchain;
- u64 aux_size;
+ struct perf_raw_record *raw;
+ struct perf_branch_stack *br_stack;
+ union perf_sample_weight weight;
+ union perf_mem_data_src data_src;
+ u64 txn;
struct perf_regs regs_user;
struct perf_regs regs_intr;
u64 stack_user_size;
- u64 phys_addr;
+ u64 stream_id;
u64 cgroup;
+ u64 addr;
+ u64 phys_addr;
u64 data_page_size;
u64 code_page_size;
+ u64 aux_size;
} ____cacheline_aligned;
/* default value for data source */
--
2.37.3.998.g577e59143f-goog
next prev parent reply other threads:[~2022-09-22 20:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 22:00 [PATCH 1/2] perf: Use sample_flags for addr Namhyung Kim
2022-09-21 22:00 ` [PATCH 2/2] perf: Use sample_flags for raw_data Namhyung Kim
2022-09-28 6:57 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2022-10-06 16:00 ` [PATCH] " Sumanth Korikkar
2022-10-06 17:12 ` Namhyung Kim
2022-10-06 18:58 ` Jiri Olsa
2022-10-07 8:13 ` [PATCH] bpf: fix sample_flags for bpf_perf_event_output Sumanth Korikkar
2022-10-07 9:45 ` Jiri Olsa
2022-10-07 15:18 ` Peter Zijlstra
2022-10-19 4:57 ` Alexei Starovoitov
2022-10-21 1:36 ` Alexei Starovoitov
2022-10-23 1:16 ` bpf+perf is still broken. Was: " Alexei Starovoitov
2022-10-23 16:55 ` Linus Torvalds
2022-10-23 17:19 ` Linus Torvalds
2022-10-23 17:28 ` Alexei Starovoitov
2022-10-17 14:45 ` [tip: perf/urgent] bpf: Fix " tip-bot2 for Sumanth Korikkar
2022-10-17 19:27 ` [PATCH] bpf: fix " SeongJae Park
2022-10-17 22:52 ` Namhyung Kim
2022-10-17 23:35 ` SeongJae Park
2022-10-19 10:44 ` [tip: perf/core] perf: Use sample_flags for raw_data Athira Rajeev
2022-09-22 14:48 ` [PATCH 1/2] perf: Use sample_flags for addr Peter Zijlstra
2022-09-22 16:32 ` Namhyung Kim
2022-09-22 20:55 ` Namhyung Kim [this message]
2022-09-23 7:45 ` Peter Zijlstra
2022-09-28 6:57 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220922205550.3094090-1-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=songliubraving@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®