perf inject: Lazily allocate guest_event event_buf
authorIan Rogers <irogers@google.com>
Sat, 27 May 2023 03:43:22 +0000 (20:43 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 12 Jun 2023 21:18:14 +0000 (18:18 -0300)
commit892d00fba18a6dec2620165ce05e1697496f8381
tree8ecb3d6d45b382f274dedf6732b17a4d1cfac8a8
parentd3944f0ed4e4039201b160fc11004abaa2ca5385
perf inject: Lazily allocate guest_event event_buf

The event_buf is 64kb (PERF_SAMPLE_SIZE_MAX) and stack allocated in
struct perf_inject. It is used for guest events that may not exist in
a file. Make the array allocation lazy to cut down on the stack usage.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230527034324.2597593-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-inject.c