summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorVaibhav Nagarnaik <vnagarnaik@google.com>2011-05-03 20:56:42 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-06-14 22:04:39 -0400
commit7ea5906405a1f3fc1c0033dfd7e02f2cfd1de5e5 (patch)
treef75e962db25ccd3efa81e1fc69ce3e60d228c7a6 /kernel/trace/trace.c
parente7e2ee89a9dbf48d70a922d5625cd7320a27cbff (diff)
tracing: Use NUMA allocation for per-cpu ring buffer pages
The tracing ring buffer is a group of per-cpu ring buffers where allocation and logging is done on a per-cpu basis. The events that are generated on a particular CPU are logged in the corresponding buffer. This is to provide wait-free writes between CPUs and good NUMA node locality while accessing the ring buffer. However, the allocation routines consider NUMA locality only for buffer page metadata and not for the actual buffer page. This causes the pages to be allocated on the NUMA node local to the CPU where the allocation routine is running at the time. This patch fixes the problem by using a NUMA node specific allocation routine so that the pages are allocated from a NUMA node local to the logging CPU. I tested with the getuid_microbench from autotest. It is a simple binary that calls getuid() in a loop and measures the average time for the syscall to complete. The following command was used to test: $ getuid_microbench 1000000 Compared the numbers found on kernel with and without this patch and found that logging latency decreases by 30-50 ns/call. tracing with non-NUMA allocation - 569 ns/call tracing with NUMA allocation - 512 ns/call Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Michael Rubin <mrubin@google.com> Cc: David Sharp <dhsharp@google.com> Link: http://lkml.kernel.org/r/1304470602-20366-1-git-send-email-vnagarnaik@google.com Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 71777c8fe36b..61fda6b6f1ab 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3697,7 +3697,7 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
3697 return 0; 3697 return 0;
3698 3698
3699 if (!info->spare) 3699 if (!info->spare)
3700 info->spare = ring_buffer_alloc_read_page(info->tr->buffer); 3700 info->spare = ring_buffer_alloc_read_page(info->tr->buffer, info->cpu);
3701 if (!info->spare) 3701 if (!info->spare)
3702 return -ENOMEM; 3702 return -ENOMEM;
3703 3703
@@ -3854,7 +3854,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
3854 3854
3855 ref->ref = 1; 3855 ref->ref = 1;
3856 ref->buffer = info->tr->buffer; 3856 ref->buffer = info->tr->buffer;
3857 ref->page = ring_buffer_alloc_read_page(ref->buffer); 3857 ref->page = ring_buffer_alloc_read_page(ref->buffer, info->cpu);
3858 if (!ref->page) { 3858 if (!ref->page) {
3859 kfree(ref); 3859 kfree(ref);
3860 break; 3860 break;
@@ -3863,8 +3863,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
3863 r = ring_buffer_read_page(ref->buffer, &ref->page, 3863 r = ring_buffer_read_page(ref->buffer, &ref->page,
3864 len, info->cpu, 1); 3864 len, info->cpu, 1);
3865 if (r < 0) { 3865 if (r < 0) {
3866 ring_buffer_free_read_page(ref->buffer, 3866 ring_buffer_free_read_page(ref->buffer, ref->page);
3867 ref->page);
3868 kfree(ref); 3867 kfree(ref);
3869 break; 3868 break;
3870 } 3869 }