lkml.org 
[lkml]   [2010]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 4/5] perf: Avoid local_xchg
Since the x86 XCHG ins implies LOCK, avoid the use by using a sequence
count instead.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/perf_event.h | 1 +
kernel/perf_event.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/perf_event.h
===================================================================
--- linux-2.6.orig/include/linux/perf_event.h
+++ linux-2.6/include/linux/perf_event.h
@@ -804,6 +804,7 @@ struct perf_output_handle {
struct perf_mmap_data *data;
unsigned long head;
unsigned long offset;
+ unsigned long wakeup;
int nmi;
int sample;
};
Index: linux-2.6/kernel/perf_event.c
===================================================================
--- linux-2.6.orig/kernel/perf_event.c
+++ linux-2.6/kernel/perf_event.c
@@ -2917,6 +2917,7 @@ static void perf_output_get_handle(struc

preempt_disable();
local_inc(&data->nest);
+ handle->wakeup = local_read(&data->wakeup);
}

static void perf_output_put_handle(struct perf_output_handle *handle)
@@ -2950,7 +2951,7 @@ again:
goto again;
}

- if (local_xchg(&data->wakeup, 0))
+ if (handle->wakeup != local_read(&data->wakeup))
perf_output_wakeup(handle);

preempt_enable();



\
 
 \ /
  Last update: 2010-05-18 15:49    [W:3.482 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site