From: Nelson Elhage Date: Mon, 19 Dec 2011 13:39:31 +0000 (-0500) Subject: perf: builtin-record: Provide advice if mmap'ing fails with EPERM. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=18e6093904abfd51671ff5846c2fdaba9ebbf21b;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1324301972-22740-3-git-send-email-nelhage@nelhage.com Signed-off-by: Nelson Elhage Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f8fd14fb62ec..56bb4476e3ba 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -272,8 +272,15 @@ try_again: exit(-1); } - if (perf_evlist__mmap(evlist, opts->mmap_pages, false) < 0) + if (perf_evlist__mmap(evlist, opts->mmap_pages, false) < 0) { + if (errno == EPERM) + die("Permission error mapping pages.\n" + "Consider increasing " + "/proc/sys/kernel/perf_event_mlock_kb,\n" + "or try again with a smaller value of -m/--mmap_pages.\n" + "(current value: %d)\n", opts->mmap_pages); die("failed to mmap with %d (%s)\n", errno, strerror(errno)); + } if (rec->file_new) session->evlist = evlist;