From: tip-bot for Peter Zijlstra <peterz@infradead.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, paulus@samba.org,
eranian@google.com, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, efault@gmx.de, peterz@infradead.org,
fweisbec@gmail.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/core] perf: Optimize buffer placement by allocating buffers NUMA aware
Date: Tue, 18 May 2010 17:16:20 GMT [thread overview]
Message-ID: <tip-a19d35c11fd559dd7dfd5a2078df7c9af74a5d88@git.kernel.org> (raw)
In-Reply-To: <1274114880.5605.5236.camel@twins>
Commit-ID: a19d35c11fd559dd7dfd5a2078df7c9af74a5d88
Gitweb: http://git.kernel.org/tip/a19d35c11fd559dd7dfd5a2078df7c9af74a5d88
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Mon, 17 May 2010 18:48:00 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 May 2010 18:35:47 +0200
perf: Optimize buffer placement by allocating buffers NUMA aware
Ensure cpu bound buffers live on the right NUMA node.
Suggested-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1274114880.5605.5236.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
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 8d61d29..6ae6218 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2320,6 +2320,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)
{
@@ -2336,12 +2349,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;
}
next prev parent reply other threads:[~2010-05-18 17:17 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
2010-05-18 17:16 ` tip-bot for Peter Zijlstra [this message]
2010-05-11 15:00 ` 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=tip-a19d35c11fd559dd7dfd5a2078df7c9af74a5d88@git.kernel.org \
--to=peterz@infradead.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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