Skip to content

Commit 0089fa9

Browse files
Jiri Olsaacmel
authored andcommitted
perf record: Fix mmap error output condition
The mmap_pages default value is not power of 2 (UINT_MAX). Together with perf_evlist__mmap function returning error value different from EPERM, we get misleading error message: "--mmap_pages/-m value must be a power of two." Fixing this by adding extra check for UINT_MAX value for this error condition. Signed-off-by: Jiri Olsa <[email protected]> Cc: Corey Ashford <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent e84ba4e commit 0089fa9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/perf/builtin-record.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ static int perf_record__open(struct perf_record *rec)
363363
"or try again with a smaller value of -m/--mmap_pages.\n"
364364
"(current value: %d)\n", opts->mmap_pages);
365365
rc = -errno;
366-
} else if (!is_power_of_2(opts->mmap_pages)) {
366+
} else if (!is_power_of_2(opts->mmap_pages) &&
367+
(opts->mmap_pages != UINT_MAX)) {
367368
pr_err("--mmap_pages/-m value must be a power of two.");
368369
rc = -EINVAL;
369370
} else {

0 commit comments

Comments
 (0)