Преглед изворни кода

ring-buffer: Pass delta by value and not by reference

The delta between events is passed to the timestamp code by reference
and the timestamp code will reset the value. But it can be reset
from the caller. No need to pass it in by reference.

By changing the call to pass by value, lets gcc optimize the code
a bit more where it can store the delta in a register and not
worry about updating the reference.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt пре 14 година
родитељ
комит
f25106aeab
1 измењених фајлова са 8 додато и 8 уклоњено
  1. 8 8
      kernel/trace/ring_buffer.c

+ 8 - 8
kernel/trace/ring_buffer.c

@@ -2008,14 +2008,14 @@ rb_try_to_discard(struct ring_buffer_per_cpu *cpu_buffer,
 
 
 static int
 static int
 rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
 rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
-		  u64 ts, u64 *delta)
+		  u64 ts, u64 delta)
 {
 {
 	struct ring_buffer_event *event;
 	struct ring_buffer_event *event;
 	int ret;
 	int ret;
 
 
-	WARN_ONCE(*delta > (1ULL << 59),
+	WARN_ONCE(delta > (1ULL << 59),
 		  KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n",
 		  KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n",
-		  (unsigned long long)*delta,
+		  (unsigned long long)delta,
 		  (unsigned long long)ts,
 		  (unsigned long long)ts,
 		  (unsigned long long)cpu_buffer->write_stamp);
 		  (unsigned long long)cpu_buffer->write_stamp);
 
 
@@ -2041,8 +2041,8 @@ rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
 		 * and if we can't just make it zero.
 		 * and if we can't just make it zero.
 		 */
 		 */
 		if (rb_event_index(event)) {
 		if (rb_event_index(event)) {
-			event->time_delta = *delta & TS_MASK;
-			event->array[0] = *delta >> TS_SHIFT;
+			event->time_delta = delta & TS_MASK;
+			event->array[0] = delta >> TS_SHIFT;
 		} else {
 		} else {
 			/* try to discard, since we do not need this */
 			/* try to discard, since we do not need this */
 			if (!rb_try_to_discard(cpu_buffer, event)) {
 			if (!rb_try_to_discard(cpu_buffer, event)) {
@@ -2064,8 +2064,6 @@ rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
 		ret = 0;
 		ret = 0;
 	}
 	}
 
 
-	*delta = 0;
-
 	return ret;
 	return ret;
 }
 }
 
 
@@ -2175,7 +2173,9 @@ rb_reserve_next_event(struct ring_buffer *buffer,
 		delta = diff;
 		delta = diff;
 		if (unlikely(test_time_stamp(delta))) {
 		if (unlikely(test_time_stamp(delta))) {
 
 
-			commit = rb_add_time_stamp(cpu_buffer, ts, &delta);
+			commit = rb_add_time_stamp(cpu_buffer, ts, delta);
+			delta = 0;
+
 			if (commit == -EBUSY)
 			if (commit == -EBUSY)
 				goto out_fail;
 				goto out_fail;