aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-10-20 12:40:12 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-10-20 12:40:12 -0400
commitf25106aeab7408394b9dd707e5ecf557e269c723 (patch)
tree58013e1e5eb776a921cbc8f3ef86267472fea8be /kernel
parente8bc43e84fada397af1b677b07dbf26e6ac78fcc (diff)
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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ring_buffer.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index c8ce6bde7fa..3af77cd47f2 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2008,14 +2008,14 @@ rb_try_to_discard(struct ring_buffer_per_cpu *cpu_buffer,
2008 2008
2009static int 2009static int
2010rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer, 2010rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
2011 u64 ts, u64 *delta) 2011 u64 ts, u64 delta)
2012{ 2012{
2013 struct ring_buffer_event *event; 2013 struct ring_buffer_event *event;
2014 int ret; 2014 int ret;
2015 2015
2016 WARN_ONCE(*delta > (1ULL << 59), 2016 WARN_ONCE(delta > (1ULL << 59),
2017 KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n", 2017 KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n",
2018 (unsigned long long)*delta, 2018 (unsigned long long)delta,
2019 (unsigned long long)ts, 2019 (unsigned long long)ts,
2020 (unsigned long long)cpu_buffer->write_stamp); 2020 (unsigned long long)cpu_buffer->write_stamp);
2021 2021
@@ -2041,8 +2041,8 @@ rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
2041 * and if we can't just make it zero. 2041 * and if we can't just make it zero.
2042 */ 2042 */
2043 if (rb_event_index(event)) { 2043 if (rb_event_index(event)) {
2044 event->time_delta = *delta & TS_MASK; 2044 event->time_delta = delta & TS_MASK;
2045 event->array[0] = *delta >> TS_SHIFT; 2045 event->array[0] = delta >> TS_SHIFT;
2046 } else { 2046 } else {
2047 /* try to discard, since we do not need this */ 2047 /* try to discard, since we do not need this */
2048 if (!rb_try_to_discard(cpu_buffer, event)) { 2048 if (!rb_try_to_discard(cpu_buffer, event)) {
@@ -2064,8 +2064,6 @@ rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
2064 ret = 0; 2064 ret = 0;
2065 } 2065 }
2066 2066
2067 *delta = 0;
2068
2069 return ret; 2067 return ret;
2070} 2068}
2071 2069
@@ -2175,7 +2173,9 @@ rb_reserve_next_event(struct ring_buffer *buffer,
2175 delta = diff; 2173 delta = diff;
2176 if (unlikely(test_time_stamp(delta))) { 2174 if (unlikely(test_time_stamp(delta))) {
2177 2175
2178 commit = rb_add_time_stamp(cpu_buffer, ts, &delta); 2176 commit = rb_add_time_stamp(cpu_buffer, ts, delta);
2177 delta = 0;
2178
2179 if (commit == -EBUSY) 2179 if (commit == -EBUSY)
2180 goto out_fail; 2180 goto out_fail;
2181 2181