Skip to content

Commit 7d1405c

Browse files
captain5050acmel
authored andcommitted
perf record: Reduce memory for recording PERF_RECORD_LOST_SAMPLES event
Reduce from PERF_SAMPLE_MAX_SIZE to "sizeof(*lost) + session->machines.host.id_hdr_size". Suggested-by: Namhyung Kim <namhyung@kernel.org> 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: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20231207021627.1322884-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 9c51f87 commit 7d1405c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/perf/builtin-record.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,8 @@ static void record__read_lost_samples(struct record *rec)
19541954

19551955
if (count.lost) {
19561956
if (!lost) {
1957-
lost = zalloc(PERF_SAMPLE_MAX_SIZE);
1957+
lost = zalloc(sizeof(*lost) +
1958+
session->machines.host.id_hdr_size);
19581959
if (!lost) {
19591960
pr_debug("Memory allocation failed\n");
19601961
return;
@@ -1970,7 +1971,8 @@ static void record__read_lost_samples(struct record *rec)
19701971
lost_count = perf_bpf_filter__lost_count(evsel);
19711972
if (lost_count) {
19721973
if (!lost) {
1973-
lost = zalloc(PERF_SAMPLE_MAX_SIZE);
1974+
lost = zalloc(sizeof(*lost) +
1975+
session->machines.host.id_hdr_size);
19741976
if (!lost) {
19751977
pr_debug("Memory allocation failed\n");
19761978
return;

0 commit comments

Comments
 (0)