diff options
author | Namhyung Kim <namhyung@kernel.org> | 2023-01-17 22:05:53 -0800 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2023-01-18 11:57:19 +0100 |
commit | 31046500c1864b8ab25d1b9846ad10aa3f7b1821 (patch) | |
tree | b5c0d120afc30522f65f58adec7ce526c7d0af77 /kernel/events/core.c | |
parent | 4cf7a136115e96241f9f1089d2b53c47accf3823 (diff) |
perf/core: Add perf_sample_save_callchain() helper
When we save the callchain to the perf sample data, we need to update
the sample flags and the dynamic size. To ensure this is done consistently,
add the perf_sample_save_callchain() helper and convert all call sites.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230118060559.615653-3-namhyung@kernel.org
Diffstat (limited to 'kernel/events/core.c')
-rw-r--r-- | kernel/events/core.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 827082d1e7f9..12b7d5114b06 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -7578,16 +7578,8 @@ void perf_prepare_sample(struct perf_event_header *header, if (sample_type & (PERF_SAMPLE_IP | PERF_SAMPLE_CODE_PAGE_SIZE)) data->ip = perf_instruction_pointer(regs); - if (sample_type & PERF_SAMPLE_CALLCHAIN) { - int size = 1; - - if (filtered_sample_type & PERF_SAMPLE_CALLCHAIN) - data->callchain = perf_callchain(event, regs); - - size += data->callchain->nr; - - data->dyn_size += size * sizeof(u64); - } + if (filtered_sample_type & PERF_SAMPLE_CALLCHAIN) + perf_sample_save_callchain(data, event, regs); if (sample_type & PERF_SAMPLE_RAW) { struct perf_raw_record *raw = data->raw; |