Skip to contentSkip to conversation

perf_counter: Increase mmap limit

tip:perfcounters/core tip-bot for Ingo Molnar 1 participant 1 message May 25, 2009

lore
Share & tools
lore
#0 lore raw
Commit-ID:  a3862d3f814ce7dfca9eed56ac23d29db3aee8d5
Gitweb:     http://git.kernel.org/tip/a3862d3f814ce7dfca9eed56ac23d29db3aee8d5
Author:     Ingo Molnar <[email protected]>
AuthorDate: Sun, 24 May 2009 09:02:37 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 24 May 2009 09:02:37 +0200

perf_counter: Increase mmap limit

In a default 'perf top' run the tool will create a counter for each online CPU. With enough CPUs this will eventually exhaust the default limit.

So scale it up with the number of online CPUs.

Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: John Kacur <[email protected]>
Cc: Mike Galbraith <[email protected]>
LKML-Reference: <new-submission>

---
 kernel/perf_counter.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
kernel/perf_counter.c +6 -0
index cb40625..6cdf824 100644
@@ -1704,6 +1704,12 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 
 	user_extra = nr_pages + 1;
 	user_lock_limit = sysctl_perf_counter_mlock >> (PAGE_SHIFT - 10);
+
+	/*
+	 * Increase the limit linearly with more CPUs:
+	 */
+	user_lock_limit *= num_online_cpus();
+
 	user_locked = atomic_long_read(&user->locked_vm) + user_extra;
 
 	extra = 0;