Skip to content

Commit 18e6093

Browse files
nelhageacmel
authored andcommitted
perf: builtin-record: Provide advice if mmap'ing fails with EPERM.
This failure is most likely due to running up against the kernel.perf_event_mlock_kb sysctl, so we can tell the user what to do to fix the issue. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1324301972-22740-3-git-send-email-nelhage@nelhage.com Signed-off-by: Nelson Elhage <nelhage@nelhage.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent f41612f commit 18e6093

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎tools/perf/builtin-record.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,15 @@ static void perf_record__open(struct perf_record *rec)
272272
exit(-1);
273273
}
274274

275-
if (perf_evlist__mmap(evlist, opts->mmap_pages, false) < 0)
275+
if (perf_evlist__mmap(evlist, opts->mmap_pages, false) < 0) {
276+
if (errno == EPERM)
277+
die("Permission error mapping pages.\n"
278+
"Consider increasing "
279+
"/proc/sys/kernel/perf_event_mlock_kb,\n"
280+
"or try again with a smaller value of -m/--mmap_pages.\n"
281+
"(current value: %d)\n", opts->mmap_pages);
276282
die("failed to mmap with %d (%s)\n", errno, strerror(errno));
283+
}
277284

278285
if (rec->file_new)
279286
session->evlist = evlist;

0 commit comments

Comments
 (0)