Skip to content

Commit f0bf1b2

Browse files
rostedtgregkh
authored andcommitted
ring-buffer: Fix first commit on sub-buffer having non-zero delta
commit d651aa1 upstream. Each sub-buffer (buffer page) has a full 64 bit timestamp. The events on that page use a 27 bit delta against that timestamp in order to save on bits written to the ring buffer. If the time between events is larger than what the 27 bits can hold, a "time extend" event is added to hold the entire 64 bit timestamp again and the events after that hold a delta from that timestamp. As a "time extend" is always paired with an event, it is logical to just allocate the event with the time extend, to make things a bit more efficient. Unfortunately, when the pairing code was written, it removed the "delta = 0" from the first commit on a page, causing the events on the page to be slightly skewed. Fixes: 69d1b83 "ring-buffer: Bind time extend and data events together" Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d15d1e0 commit f0bf1b2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎kernel/trace/ring_buffer.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,13 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
23962396
write &= RB_WRITE_MASK;
23972397
tail = write - length;
23982398

2399+
/*
2400+
* If this is the first commit on the page, then it has the same
2401+
* timestamp as the page itself.
2402+
*/
2403+
if (!tail)
2404+
delta = 0;
2405+
23992406
/* See if we shot pass the end of this buffer page */
24002407
if (unlikely(write > BUF_PAGE_SIZE))
24012408
return rb_move_tail(cpu_buffer, length, tail,

0 commit comments

Comments
 (0)