perf evlist: Clarify sterror_mmap variable names

Prep patch for doing further checks like when the number of pages that
is being attempted is actually below /proc/sys/kernel/perf_event_mlock_kb but
the operation fails because the user doesn't have CAP_IPC_LOCK.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-wetzlux7mzvofu5cuji5i71i@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0a2138b2
...@@ -1487,16 +1487,16 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist __maybe_unused, ...@@ -1487,16 +1487,16 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist __maybe_unused,
int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, size_t size) int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, size_t size)
{ {
char sbuf[STRERR_BUFSIZE], *emsg = strerror_r(err, sbuf, sizeof(sbuf)); char sbuf[STRERR_BUFSIZE], *emsg = strerror_r(err, sbuf, sizeof(sbuf));
int value; int pages_attempted = evlist->mmap_len / 1024, pages_max_per_user;
switch (err) { switch (err) {
case EPERM: case EPERM:
sysctl__read_int("kernel/perf_event_mlock_kb", &value); sysctl__read_int("kernel/perf_event_mlock_kb", &pages_max_per_user);
scnprintf(buf, size, "Error:\t%s.\n" scnprintf(buf, size, "Error:\t%s.\n"
"Hint:\tCheck /proc/sys/kernel/perf_event_mlock_kb (%d kB) setting.\n" "Hint:\tCheck /proc/sys/kernel/perf_event_mlock_kb (%d kB) setting.\n"
"Hint:\tTried using %zd kB.\n" "Hint:\tTried using %zd kB.\n"
"Hint:\tTry using a smaller -m/--mmap-pages value.", "Hint:\tTry using a smaller -m/--mmap-pages value.",
emsg, value, evlist->mmap_len / 1024); emsg, pages_max_per_user, pages_attempted);
break; break;
default: default:
scnprintf(buf, size, "%s", emsg); scnprintf(buf, size, "%s", emsg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment