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 <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
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

+4-2
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)