[PATCH 5/8] ring-buffer: Make benchmark handle missed events

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Rostedt
Date: Tuesday, April 27, 2010 - 6:27 pm

From: Steven Rostedt <srostedt@redhat.com>

With the addition of the "missed events" flags that is stored in the
commit field of the ring buffer page, the ring_buffer_benchmark
was not updated to handle this. If events are missed, then the
missed events flag is set in the ring buffer page, the benchmark
will count that flag as part of the size of the page and will hit the BUG()
when it tries to read beyond the page.

The solution is simply to have the ring buffer benchmark mask off
the extra bits.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ring_buffer_benchmark.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/ring_buffer_benchmark.c b/kernel/trace/ring_buffer_benchmark.c
index dc56556..302f8a6 100644
--- a/kernel/trace/ring_buffer_benchmark.c
+++ b/kernel/trace/ring_buffer_benchmark.c
@@ -113,7 +113,8 @@ static enum event_status read_page(int cpu)
 	ret = ring_buffer_read_page(buffer, &bpage, PAGE_SIZE, cpu, 1);
 	if (ret >= 0) {
 		rpage = bpage;
-		commit = local_read(&rpage->commit);
+		/* The commit may have missed event flags set, clear them */
+		commit = local_read(&rpage->commit) & 0xfffff;
 		for (i = 0; i < commit && !kill_test; i += inc) {
 
 			if (i >= (PAGE_SIZE - offsetof(struct rb_page, data))) {
-- 
1.7.0


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/8] [GIT PULL] tracing: various updates, Steven Rostedt, (Tue Apr 27, 6:27 pm)
[PATCH 1/8] tracing: Add ftrace events for graph tracer, Steven Rostedt, (Tue Apr 27, 6:27 pm)
[PATCH 5/8] ring-buffer: Make benchmark handle missed events, Steven Rostedt, (Tue Apr 27, 6:27 pm)
[PATCH 8/8] tracing: Fix sleep time function profiling, Steven Rostedt, (Tue Apr 27, 6:27 pm)
Re: [PATCH 0/8] [GIT PULL] tracing: various updates, Ingo Molnar, (Fri Apr 30, 1:00 am)
Re: [PATCH 0/8] [GIT PULL] tracing: various updates, Ingo Molnar, (Fri Apr 30, 2:47 am)