diff options
author | Nelson Elhage <nelhage@nelhage.com> | 2011-12-19 08:39:32 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-12-23 13:53:58 -0500 |
commit | 41d0d933494ce10eb77758a1168b08e317c42e8e (patch) | |
tree | f907773714846b5b5cf85b4f450bb6fe07b168d4 /tools/perf/util/evlist.c | |
parent | 18e6093904abfd51671ff5846c2fdaba9ebbf21b (diff) |
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 <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1324301972-22740-4-git-send-email-nelhage@nelhage.com
Signed-off-by: Nelson Elhage <nelhage@nelhage.com>
[ committer note: Made it work after 50a682c ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evlist.c')
-rw-r--r-- | tools/perf/util/evlist.c | 2 |
1 files changed, 2 insertions, 0 deletions
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, | |||
563 | /* 512 kiB: default amount of unprivileged mlocked memory */ | 563 | /* 512 kiB: default amount of unprivileged mlocked memory */ |
564 | if (pages == UINT_MAX) | 564 | if (pages == UINT_MAX) |
565 | pages = (512 * 1024) / page_size; | 565 | pages = (512 * 1024) / page_size; |
566 | else if (!is_power_of_2(pages)) | ||
567 | return -EINVAL; | ||
566 | 568 | ||
567 | mask = pages * page_size - 1; | 569 | mask = pages * page_size - 1; |
568 | 570 | ||