From 41d0d933494ce10eb77758a1168b08e317c42e8e Mon Sep 17 00:00:00 2001 From: Nelson Elhage Date: Mon, 19 Dec 2011 08:39:32 -0500 Subject: perf: builtin-record: Document and check that mmap_pages must be a power of two. Now that we automatically point users at it, let's provide them some guidance so that they hopefully don't just get mysterious EINVAL's from the kernel. Cc: Ingo Molnar Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1324301972-22740-4-git-send-email-nelhage@nelhage.com Signed-off-by: Nelson Elhage [ committer note: Made it work after 50a682c ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evlist.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/perf/util/evlist.c') diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 963d63dde457..fa1837088ca8 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -563,6 +563,8 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, /* 512 kiB: default amount of unprivileged mlocked memory */ if (pages == UINT_MAX) pages = (512 * 1024) / page_size; + else if (!is_power_of_2(pages)) + return -EINVAL; mask = pages * page_size - 1; -- cgit v1.2.2