Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146211
b: refs/heads/master
c: ea05b57
h: refs/heads/master
i:
  146209: d0da116
  146207: 8d60fc4
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Jun 3, 2009
1 parent c1256e5 commit b14c0f2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: edd813bffc62a980bb4fb9b1243f31c1cce78da3
refs/heads/master: ea05b57cc19234d8de9887c8a32c2e58e84b56ba
37 changes: 21 additions & 16 deletions trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ static inline int test_time_stamp(u64 delta)
/* Max payload is BUF_PAGE_SIZE - header (8bytes) */
#define BUF_MAX_DATA_SIZE (BUF_PAGE_SIZE - (sizeof(u32) * 2))

/* Max number of timestamps that can fit on a page */
#define RB_TIMESTAMPS_PER_PAGE (BUF_PAGE_SIZE / RB_LEN_TIME_STAMP)

int ring_buffer_print_page_header(struct trace_seq *s)
{
struct buffer_data_page field;
Expand Down Expand Up @@ -1409,8 +1412,12 @@ rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
event->array[0] = *delta >> TS_SHIFT;
} else {
cpu_buffer->commit_page->page->time_stamp = *ts;
event->time_delta = 0;
event->array[0] = 0;
/* try to discard, since we do not need this */
if (!rb_try_to_discard(cpu_buffer, event)) {
/* nope, just zero it */
event->time_delta = 0;
event->array[0] = 0;
}
}
cpu_buffer->write_stamp = *ts;
/* let the caller know this was the commit */
Expand Down Expand Up @@ -2268,8 +2275,8 @@ static void rb_advance_iter(struct ring_buffer_iter *iter)
* Check if we are at the end of the buffer.
*/
if (iter->head >= rb_page_size(iter->head_page)) {
if (RB_WARN_ON(buffer,
iter->head_page == cpu_buffer->commit_page))
/* discarded commits can make the page empty */
if (iter->head_page == cpu_buffer->commit_page)
return;
rb_inc_iter(iter);
return;
Expand Down Expand Up @@ -2312,12 +2319,10 @@ rb_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts)
/*
* We repeat when a timestamp is encountered. It is possible
* to get multiple timestamps from an interrupt entering just
* as one timestamp is about to be written. The max times
* that this can happen is the number of nested interrupts we
* can have. Nesting 10 deep of interrupts is clearly
* an anomaly.
* as one timestamp is about to be written, or from discarded
* commits. The most that we can have is the number on a single page.
*/
if (RB_WARN_ON(cpu_buffer, ++nr_loops > 10))
if (RB_WARN_ON(cpu_buffer, ++nr_loops > RB_TIMESTAMPS_PER_PAGE))
return NULL;

reader = rb_get_reader_page(cpu_buffer);
Expand Down Expand Up @@ -2383,14 +2388,14 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts)

again:
/*
* We repeat when a timestamp is encountered. It is possible
* to get multiple timestamps from an interrupt entering just
* as one timestamp is about to be written. The max times
* that this can happen is the number of nested interrupts we
* can have. Nesting 10 deep of interrupts is clearly
* an anomaly.
* We repeat when a timestamp is encountered.
* We can get multiple timestamps by nested interrupts or also
* if filtering is on (discarding commits). Since discarding
* commits can be frequent we can get a lot of timestamps.
* But we limit them by not adding timestamps if they begin
* at the start of a page.
*/
if (RB_WARN_ON(cpu_buffer, ++nr_loops > 10))
if (RB_WARN_ON(cpu_buffer, ++nr_loops > RB_TIMESTAMPS_PER_PAGE))
return NULL;

if (rb_per_cpu_empty(cpu_buffer))
Expand Down

0 comments on commit b14c0f2

Please sign in to comment.