aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2008-11-27 18:36:08 +0100
committerRobert Richter <robert.richter@amd.com>2008-12-10 14:20:14 +0100
commit229234ae4a5ed9376b2e0524da04b0e5edadbf76 (patch)
tree9f0434cbac64aa2d040b0b806d239b2335c163e1
parent7d468abee0f1a7e918b5e2f23120436a54ba9f33 (diff)
downloadkernel_samsung_tuna-229234ae4a5ed9376b2e0524da04b0e5edadbf76.zip
kernel_samsung_tuna-229234ae4a5ed9376b2e0524da04b0e5edadbf76.tar.gz
kernel_samsung_tuna-229234ae4a5ed9376b2e0524da04b0e5edadbf76.tar.bz2
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>
-rw-r--r--drivers/oprofile/cpu_buffer.c18
-rw-r--r--drivers/oprofile/cpu_buffer.h17
2 files changed, 18 insertions, 17 deletions
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index 7e5e650..d6f5de6 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -148,22 +148,6 @@ static unsigned long nr_available_slots(struct oprofile_cpu_buffer const *b)
return tail + (b->buffer_size - head) - 1;
}
-static void increment_head(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 void
add_sample(struct oprofile_cpu_buffer *cpu_buf,
unsigned long pc, unsigned long event)
@@ -171,7 +155,7 @@ add_sample(struct oprofile_cpu_buffer *cpu_buf,
struct op_sample *entry = cpu_buffer_write_entry(cpu_buf);
entry->eip = pc;
entry->event = event;
- increment_head(cpu_buf);
+ cpu_buffer_write_commit(cpu_buf);
}
static inline void
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h
index 0870699..e608976 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)
}
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)
{
return &cpu_buf->buffer[cpu_buf->tail_pos];