From: Steven Rostedt <rostedt@goodmis.org>
Date: Thu, 2 Oct 2008 23:18:09 +0000 (-0400)
Subject: ring_buffer: map to cpu not page
X-Git-Tag: v2.6.28-rc1~78^2~20
X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=aa1e0e3bcf95ce684d005bedb16e5d4559455685;p=linux-2.6-omap-h63xx.git

ring_buffer: map to cpu not page

My original patch had a compile bug when NUMA was configured. I
referenced cpu when it should have been cpu_buffer->cpu.

Ingo quickly fixed this bug by replacing cpu with 'i' because that
was the loop counter. Unfortunately, the 'i' was the counter of
pages, not CPUs. This caused a crash when the number of pages allocated
for the buffers exceeded the number of pages, which would usually
be the case.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 54a30986493..6b8dac02364 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -232,7 +232,7 @@ static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,
 
 	for (i = 0; i < nr_pages; i++) {
 		page = kzalloc_node(ALIGN(sizeof(*page), cache_line_size()),
-				    GFP_KERNEL, cpu_to_node(i));
+				    GFP_KERNEL, cpu_to_node(cpu_buffer->cpu));
 		if (!page)
 			goto free_pages;
 		list_add(&page->list, &pages);