[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-a19d35c11fd559dd7dfd5a2078df7c9af74a5d88@git.kernel.org>
Date: Tue, 18 May 2010 17:16:20 GMT
From: tip-bot for Peter Zijlstra <peterz@...radead.org>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org,
eranian@...gle.com, hpa@...or.com, mingo@...hat.com,
a.p.zijlstra@...llo.nl, efault@....de, peterz@...radead.org,
fweisbec@...il.com, tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perf/core] perf: Optimize buffer placement by allocating buffers NUMA aware
Commit-ID: a19d35c11fd559dd7dfd5a2078df7c9af74a5d88
Gitweb: http://git.kernel.org/tip/a19d35c11fd559dd7dfd5a2078df7c9af74a5d88
Author: Peter Zijlstra <peterz@...radead.org>
AuthorDate: Mon, 17 May 2010 18:48:00 +0200
Committer: Ingo Molnar <mingo@...e.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@...gle.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
LKML-Reference: <1274114880.5605.5236.camel@...ns>
Signed-off-by: Ingo Molnar <mingo@...e.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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists