Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146083
b: refs/heads/master
c: e4906ef
h: refs/heads/master
i:
  146081: 852c566
  146079: 01b5f1b
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 5, 2009
1 parent 42935da commit e7ab0ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 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: c8d771835e18c938dae8690611d65fe98ad30f58
refs/heads/master: e4906eff9e6fbd2d311abcbcc53d5a531773c982
21 changes: 12 additions & 9 deletions trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ struct ring_buffer_per_cpu {
unsigned long nmi_dropped;
unsigned long commit_overrun;
unsigned long overrun;
unsigned long entries;
unsigned long read;
local_t entries;
u64 write_stamp;
u64 read_stamp;
atomic_t record_disabled;
Expand Down Expand Up @@ -997,7 +998,6 @@ static void rb_update_overflow(struct ring_buffer_per_cpu *cpu_buffer)
if (event->type_len > RINGBUF_TYPE_DATA_TYPE_LEN_MAX)
continue;
cpu_buffer->overrun++;
cpu_buffer->entries--;
}
}

Expand Down Expand Up @@ -1588,7 +1588,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_lock_reserve);
static void rb_commit(struct ring_buffer_per_cpu *cpu_buffer,
struct ring_buffer_event *event)
{
cpu_buffer->entries++;
local_inc(&cpu_buffer->entries);

/* Only process further if we own the commit */
if (!rb_is_commit(cpu_buffer, event))
Expand Down Expand Up @@ -1722,7 +1722,7 @@ void ring_buffer_discard_commit(struct ring_buffer *buffer,
* The commit is still visible by the reader, so we
* must increment entries.
*/
cpu_buffer->entries++;
local_inc(&cpu_buffer->entries);
out:
/*
* If a write came in and pushed the tail page
Expand Down Expand Up @@ -1902,7 +1902,8 @@ unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu)
return 0;

cpu_buffer = buffer->buffers[cpu];
ret = cpu_buffer->entries;
ret = (local_read(&cpu_buffer->entries) - cpu_buffer->overrun)
- cpu_buffer->read;

return ret;
}
Expand Down Expand Up @@ -1985,7 +1986,8 @@ unsigned long ring_buffer_entries(struct ring_buffer *buffer)
/* if you care about this being correct, lock the buffer */
for_each_buffer_cpu(buffer, cpu) {
cpu_buffer = buffer->buffers[cpu];
entries += cpu_buffer->entries;
entries += (local_read(&cpu_buffer->entries) -
cpu_buffer->overrun) - cpu_buffer->read;
}

return entries;
Expand Down Expand Up @@ -2225,7 +2227,7 @@ static void rb_advance_reader(struct ring_buffer_per_cpu *cpu_buffer)

if (event->type_len <= RINGBUF_TYPE_DATA_TYPE_LEN_MAX
|| rb_discarded_event(event))
cpu_buffer->entries--;
cpu_buffer->read++;

rb_update_read_stamp(cpu_buffer, event);

Expand Down Expand Up @@ -2642,7 +2644,8 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
cpu_buffer->nmi_dropped = 0;
cpu_buffer->commit_overrun = 0;
cpu_buffer->overrun = 0;
cpu_buffer->entries = 0;
cpu_buffer->read = 0;
local_set(&cpu_buffer->entries, 0);

cpu_buffer->write_stamp = 0;
cpu_buffer->read_stamp = 0;
Expand Down Expand Up @@ -2813,7 +2816,7 @@ static void rb_remove_entries(struct ring_buffer_per_cpu *cpu_buffer,
/* Only count data entries */
if (event->type_len > RINGBUF_TYPE_DATA_TYPE_LEN_MAX)
continue;
cpu_buffer->entries--;
cpu_buffer->read++;
}
__raw_spin_unlock(&cpu_buffer->lock);
}
Expand Down

0 comments on commit e7ab0ec

Please sign in to comment.