Skip to contentSkip to conversation

ftrace: optimize duration filter event discard

PATCH In review Tim Bird 1 participant 1 message Jul 6, 2009

Subsystems (2)
lore
Share & tools
lore

Tim Bird

author
#0 lore raw

PATCH 2/2 ftrace: optimize duration filter event discard

Add a routine to allow optimizing the removal of the last committed entry in the trace log. This is useful for function duration tracing, and can greatly expand the time coverage of a trace, by reclaiming almost all space for filtered function events.

Please review the FIXTHIS lines, and let me know if better concurrency control is needed here.

---
 include/linux/ring_buffer.h |    8 +++++++
 kernel/trace/ring_buffer.c  |   45 ++++++++++++++++++++++++++++++++++++++++++++
 kernel/trace/trace.c        |    2 -
 3 files changed, 54 insertions(+), 1 deletion(-)
include/linux/ring_buffer.h +8 -0
@@ -106,6 +106,14 @@ void ring_buffer_discard_commit(struct r
 				struct ring_buffer_event *event);
 
 /*
+ * ring_buffer_rewind_tail will remove an event that has already
+ *   been committed.  It remains to be determined if it is safe to
+ *   do this.
+ */
+void ring_buffer_rewind_tail(struct ring_buffer *buffer,
+				struct ring_buffer_event *event);
+
+/*
  * size is in bytes for each per CPU buffer.
  */
 struct ring_buffer *
kernel/trace/ring_buffer.c +45 -0

51 lines not on this page · raw message

kernel/trace/trace.c +1 -1
@@ -999,7 +999,7 @@ static void trace_buffer_discard_func_en
 
 	prev_entry = ring_buffer_event_data(prev_event);
 	if (func == prev_entry->graph_ent.func) {
-		ring_buffer_event_discard(prev_event);
+		ring_buffer_rewind_tail(global_trace.buffer, prev_event);
 	}
 }