aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/cpu_buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/cpu_buffer.h')
-rw-r--r--drivers/oprofile/cpu_buffer.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h
index 08706991fdd2..e6089768ae66 100644
--- a/drivers/oprofile/cpu_buffer.h
+++ b/drivers/oprofile/cpu_buffer.h
@@ -59,6 +59,23 @@ struct op_sample *cpu_buffer_write_entry(struct oprofile_cpu_buffer *cpu_buf)
59} 59}
60 60
61static inline 61static inline
62void cpu_buffer_write_commit(struct oprofile_cpu_buffer *b)
63{
64 unsigned long new_head = b->head_pos + 1;
65
66 /*
67 * Ensure anything written to the slot before we increment is
68 * visible
69 */
70 wmb();
71
72 if (new_head < b->buffer_size)
73 b->head_pos = new_head;
74 else
75 b->head_pos = 0;
76}
77
78static inline
62struct op_sample *cpu_buffer_read_entry(struct oprofile_cpu_buffer *cpu_buf) 79struct op_sample *cpu_buffer_read_entry(struct oprofile_cpu_buffer *cpu_buf)
63{ 80{
64 return &cpu_buf->buffer[cpu_buf->tail_pos]; 81 return &cpu_buf->buffer[cpu_buf->tail_pos];