diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2011-03-23 19:29:39 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-14 13:01:58 -0700 |
commit | 6c66673c8abb839c99b9692d02ec8032a11e67af (patch) | |
tree | 2e2c0c6cee42b9ad5cd24c65a822f66baf9d7bf6 /kernel | |
parent | c27b92295ab4c6b90b1cee94c4c9c1b4732e1c2e (diff) | |
download | linux-stable-6c66673c8abb839c99b9692d02ec8032a11e67af.tar.gz linux-stable-6c66673c8abb839c99b9692d02ec8032a11e67af.tar.bz2 linux-stable-6c66673c8abb839c99b9692d02ec8032a11e67af.zip |
perf: Better fit max unprivileged mlock pages for tools needs
commit 880f57318450dbead6a03f9e31a1468924d6dd88 upstream.
The maximum kilobytes of locked memory that an unprivileged user
can reserve is of 512 kB = 128 pages by default, scaled to the
number of onlined CPUs, which fits well with the tools that use
128 data pages by default.
However tools actually use 129 pages, because they need one more
for the user control page. Thus the default mlock threshold is
not sufficient for the default tools needs and we always end up
to evaluate the constant mlock rlimit policy, which doesn't have
this scaling with the number of online CPUs.
Hence, on systems that have more than 16 CPUs, we overlap the
rlimit threshold and fail to mmap:
$ perf record ls
Error: failed to mmap with 1 (Operation not permitted)
Just increase the max unprivileged mlock threshold by one page
so that it supports well perf tools even after 16 CPUs.
Reported-by: Han Pingtian <phan@redhat.com>
Reported-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <1300904979-5508-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/perf_event.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index ad02feadb6b0..f81f9d6395ad 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -62,7 +62,8 @@ static struct srcu_struct pmus_srcu; */ int sysctl_perf_event_paranoid __read_mostly = 1; -int sysctl_perf_event_mlock __read_mostly = 512; /* 'free' kb per user */ +/* Minimum for 128 pages + 1 for the user control page */ +int sysctl_perf_event_mlock __read_mostly = 516; /* 'free' kb per user */ /* * max perf event sample rate |