perf/core: Save the dynamic parts of sample data size
authorNamhyung Kim <namhyung@kernel.org>
Wed, 18 Jan 2023 06:05:52 +0000 (22:05 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 18 Jan 2023 10:57:19 +0000 (11:57 +0100)
commit4cf7a136115e96241f9f1089d2b53c47accf3823
treeff5a1458b75ba4582594974c05d46680797f3914
parent65adf3a57c0c2e79c5c2b72a4bdcabcab9e99ec1
perf/core: Save the dynamic parts of sample data size

The perf sample data can be divided into parts.  The event->header_size
and event->id_header_size keep the static part of the sample data which
is determined by the sample_type flags.

But other parts like CALLCHAIN and BRANCH_STACK are changing dynamically
so it needs to see the actual data.  In preparation of handling repeated
calls for perf_prepare_sample(), it can save the dynamic size to the
perf sample data to avoid the duplicate work.

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-2-namhyung@kernel.org
include/linux/perf_event.h
kernel/events/core.c