lkml.org 
[lkml]   [2011]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] perf: builtin-record: Provide advice if mmap'ing fails with EPERM.
Date
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.

Signed-off-by: Nelson Elhage <nelhage@nelhage.com>
---
tools/perf/builtin-record.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6ab58cc..45b23c1 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -358,8 +358,15 @@ try_again:
exit(-1);
}

- if (perf_evlist__mmap(evlist, mmap_pages, false) < 0)
+ if (perf_evlist__mmap(evlist, 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", mmap_pages);
die("failed to mmap with %d (%s)\n", errno, strerror(errno));
+ }

if (file_new)
session->evlist = evlist;
--
1.7.4.41.g50b8f


\
 
 \ /
  Last update: 2011-12-19 14:43    [W:0.086 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site