oprofile: adding cpu_buffer_write_commit()

This is in preparation for changes in the cpu buffer implementation.

Signed-off-by: Robert Richter <robert.richter@amd.com>
This commit is contained in:
Robert Richter
2008-11-27 18:36:08 +01:00
parent 7d468abee0
commit 229234ae4a
2 changed files with 18 additions and 17 deletions
+17
View File
@@ -58,6 +58,23 @@ struct op_sample *cpu_buffer_write_entry(struct oprofile_cpu_buffer *cpu_buf)
return &cpu_buf->buffer[cpu_buf->head_pos];
}
static inline
void cpu_buffer_write_commit(struct oprofile_cpu_buffer *b)
{
unsigned long new_head = b->head_pos + 1;
/*
* Ensure anything written to the slot before we increment is
* visible
*/
wmb();
if (new_head < b->buffer_size)
b->head_pos = new_head;
else
b->head_pos = 0;
}
static inline
struct op_sample *cpu_buffer_read_entry(struct oprofile_cpu_buffer *cpu_buf)
{