summaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-02 16:16:02 +0200
committerIngo Molnar <mingo@elte.hu>2009-06-02 21:45:32 +0200
commit8e3747c13c39246c7e46def7cf495d9d21d4c5f9 (patch)
tree6a57736dd784947dbd40b75674effcb63e6696a1 /kernel/perf_counter.c
parente4abb5d4f7ddabc1fc7c392cf0a10d8e5868c9ca (diff)
downloadlinux-8e3747c13c39246c7e46def7cf495d9d21d4c5f9.tar.bz2
perf_counter: Change data head from u32 to u64
Since some people worried that 4G might not be a large enough as an mmap data window, extend it to 64 bit for capable platforms. Reported-by: Stephane Eranian <eranian@googlemail.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 5ecd9981c035..3f11a2bc6c79 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2067,8 +2067,8 @@ __weak struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
struct perf_output_handle {
struct perf_counter *counter;
struct perf_mmap_data *data;
- unsigned int offset;
- unsigned int head;
+ unsigned long head;
+ unsigned long offset;
int nmi;
int overflow;
int locked;
@@ -2122,7 +2122,8 @@ static void perf_output_lock(struct perf_output_handle *handle)
static void perf_output_unlock(struct perf_output_handle *handle)
{
struct perf_mmap_data *data = handle->data;
- int head, cpu;
+ unsigned long head;
+ int cpu;
data->done_head = data->head;
@@ -2135,7 +2136,7 @@ again:
* before we publish the new head, matched by a rmb() in userspace when
* reading this position.
*/
- while ((head = atomic_xchg(&data->done_head, 0)))
+ while ((head = atomic_long_xchg(&data->done_head, 0)))
data->user_page->data_head = head;
/*
@@ -2148,7 +2149,7 @@ again:
/*
* Therefore we have to validate we did not indeed do so.
*/
- if (unlikely(atomic_read(&data->done_head))) {
+ if (unlikely(atomic_long_read(&data->done_head))) {
/*
* Since we had it locked, we can lock it again.
*/
@@ -2195,7 +2196,7 @@ static int perf_output_begin(struct perf_output_handle *handle,
do {
offset = head = atomic_read(&data->head);
head += size;
- } while (atomic_cmpxchg(&data->head, offset, head) != offset);
+ } while (atomic_long_cmpxchg(&data->head, offset, head) != offset);
handle->offset = offset;
handle->head = head;
@@ -2246,7 +2247,7 @@ static void perf_output_copy(struct perf_output_handle *handle,
* Check we didn't copy past our reservation window, taking the
* possible unsigned int wrap into account.
*/
- WARN_ON_ONCE(((int)(handle->head - handle->offset)) < 0);
+ WARN_ON_ONCE(((long)(handle->head - handle->offset)) < 0);
}
#define perf_output_put(handle, x) \