mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 2/2] perf: Mmap 512 kiB by default
Date: Thu, 31 Mar 2011 03:35:24 +0200	[thread overview]
Message-ID: <1301535324-9735-1-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1301496028.4859.183.camel@twins>

The default setting of perf record is to mmap 128 pages if the user
did not override with -m.
However the page size may vary accross different architecture
settings, giving different default size between each.

Moreover the kernel side still has a default max number of mlocked
pages of 512 kiB + 1 page for unprivileged users. 128 + 1 pages
with page size > 4096 overlaps this threshold.

Thus, better adapt to this limitation and set the default number of
pages to fit those 512 kiB + 1 page.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/builtin-record.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6febcc1..a7e14bd 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -41,7 +41,7 @@ static u64			user_interval			= ULLONG_MAX;
 static u64			default_interval		=      0;
 
 static unsigned int		page_size;
-static unsigned int		mmap_pages			=    128;
+static unsigned int		mmap_pages			= UINT_MAX;
 static unsigned int		user_freq 			= UINT_MAX;
 static int			freq				=   1000;
 static int			output;
@@ -506,6 +506,10 @@ static int __cmd_record(int argc, const char **argv)
 	if (have_tracepoints(&evsel_list->entries))
 		perf_header__set_feat(&session->header, HEADER_TRACE_INFO);
 
+	/* 512 kiB: default amount of unprivileged mlocked memory */
+	if (mmap_pages == UINT_MAX)
+		mmap_pages = (512 * 1024) / page_size;
+
 	if (forks) {
 		child_pid = fork();
 		if (child_pid < 0) {
-- 
1.7.3.2


  parent reply	other threads:[~2011-03-31  1:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 18:29 [PATCH] perf: Better fit max unprivileged mlock pages for tools needs Frederic Weisbecker
2011-03-23 18:38 ` Arnaldo Carvalho de Melo
2011-03-23 21:19 ` [tip:perf/urgent] " tip-bot for Frederic Weisbecker
2011-03-25 10:32 ` [PATCH] " Peter Zijlstra
2011-03-25 14:50   ` Frederic Weisbecker
2011-03-25 15:05     ` Peter Zijlstra
2011-03-30 14:04       ` [PATCH] perf: Rebase max unprivileged mlock threshold on top of page size Frederic Weisbecker
2011-03-30 14:40         ` Peter Zijlstra
2011-03-30 14:53           ` Frederic Weisbecker
2011-03-31  1:33           ` [PATCH 1/2 v2] " Frederic Weisbecker
2011-03-31 12:41             ` [tip:perf/urgent] " tip-bot for Frederic Weisbecker
2011-03-31  1:35           ` Frederic Weisbecker [this message]
2011-03-31  8:09             ` [PATCH 2/2] perf: Mmap 512 kiB by default Peter Zijlstra
2011-03-31 12:33               ` Frederic Weisbecker
2011-03-31 12:41             ` [tip:perf/urgent] perf: mmap " tip-bot for Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1301535324-9735-1-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome