The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Arnaldo Carvalho de Melo" <acme@infradead.org>,
	mingo@elte.hu, "Paul Mackerras" <paulus@samba.org>,
	"David S. Miller" <davem@davemloft.net>,
	perfmon2-devel@lists.sf.net
Subject: Re: [RFC] perf: perf record sets inherit by default
Date: Mon, 17 May 2010 18:48:00 +0200	[thread overview]
Message-ID: <1274114880.5605.5236.camel@twins> (raw)
In-Reply-To: <AANLkTimZrFv7YWOdy6dvtbzFmwB85FyPntZULmN0f6VN@mail.gmail.com>

On Mon, 2010-05-17 at 16:25 +0200, Stephane Eranian wrote:
> > Right, but I think the default of inherit is right, and once you do that
> > you basically have to do the per-task-per-cpu thing, otherwise your
> > fancy 16-way will start spending most of its time in cacheline bounces.
> >
> In that case, don't you think you should also ensure that the buffer is
> allocated on the NUMA node of the designated per-thread-per-cpu?
> I don't think it is the case today.

Yeah, something like the below ought to do I guess..

Almost-Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/perf_event.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 9dbe8cd..85e2d32 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2288,6 +2288,19 @@ perf_mmap_to_page(struct perf_mmap_data *data, unsigned long pgoff)
 	return virt_to_page(data->data_pages[pgoff - 1]);
 }
 
+static void *perf_mmap_alloc_page(int cpu)
+{
+	struct page *page;
+	int node;
+
+	node = (cpu == -1) ? cpu : cpu_to_node(cpu);
+	page = alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0);
+	if (!page)
+		return NULL;
+
+	return page_address(page);
+}
+
 static struct perf_mmap_data *
 perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
 {
@@ -2304,12 +2317,12 @@ perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
 	if (!data)
 		goto fail;
 
-	data->user_page = (void *)get_zeroed_page(GFP_KERNEL);
+	data->user_page = perf_mmap_alloc_page(event->cpu);
 	if (!data->user_page)
 		goto fail_user_page;
 
 	for (i = 0; i < nr_pages; i++) {
-		data->data_pages[i] = (void *)get_zeroed_page(GFP_KERNEL);
+		data->data_pages[i] = perf_mmap_alloc_page(event->cpu);
 		if (!data->data_pages[i])
 			goto fail_data_pages;
 	}


  reply	other threads:[~2010-05-17 16:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11 14:04 [RFC] perf: perf record sets inherit by default Stephane Eranian
2010-05-11 14:48 ` Peter Zijlstra
2010-05-17 14:25   ` Stephane Eranian
2010-05-17 16:48     ` Peter Zijlstra [this message]
2010-05-18 17:16       ` [tip:perf/core] perf: Optimize buffer placement by allocating buffers NUMA aware tip-bot for Peter Zijlstra
2010-05-11 15:00 ` [RFC] perf: perf record sets inherit by default Arnaldo Carvalho de Melo
2010-05-11 15:13   ` Peter Zijlstra
2010-05-11 15:17     ` Stephane Eranian
2010-05-11 15:50     ` Arnaldo Carvalho de Melo
2010-05-11 15:52       ` Peter Zijlstra
2010-05-11 15:55         ` Stephane Eranian
2010-05-11 15:59           ` Arnaldo Carvalho de Melo
2010-05-11 15:56         ` Arnaldo Carvalho de Melo
2010-05-11 16:01           ` Stephane Eranian

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=1274114880.5605.5236.camel@twins \
    --to=peterz@infradead.org \
    --cc=acme@infradead.org \
    --cc=davem@davemloft.net \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    /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