From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>,
Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 4/5] perf: Avoid local_xchg
Date: Tue, 18 May 2010 15:33:02 +0200 [thread overview]
Message-ID: <20100518133726.128688672@chello.nl> (raw)
In-Reply-To: <20100518133258.000434886@chello.nl>
[-- Attachment #1: perf-buffer-no-xchg-wakeup.patch --]
[-- Type: text/plain, Size: 1266 bytes --]
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();
next prev parent reply other threads:[~2010-05-18 13:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 13:32 [PATCH 0/5] Optimize perf ring-buffer Peter Zijlstra
2010-05-18 13:32 ` [PATCH 1/5] perf: Disallow mmap() on per-task inherited events Peter Zijlstra
2010-05-19 7:19 ` Frederic Weisbecker
2010-05-25 0:55 ` Paul Mackerras
2010-05-25 8:19 ` Peter Zijlstra
2010-05-18 13:33 ` [PATCH 2/5] perf: Remove IRQ-disable from the perf_output path Peter Zijlstra
2010-05-18 13:33 ` [PATCH 3/5] perf: Convert the perf output buffer to local_t Peter Zijlstra
2010-05-18 13:33 ` Peter Zijlstra [this message]
2010-05-18 13:33 ` [RFC PATCH 5/5] perf: Implement perf_output_addr() Peter Zijlstra
2010-05-18 14:09 ` Peter Zijlstra
2010-05-19 7:21 ` Frederic Weisbecker
2010-05-19 7:58 ` Peter Zijlstra
2010-05-19 9:03 ` Frederic Weisbecker
2010-05-19 14:47 ` Steven Rostedt
2010-05-19 15:05 ` Peter Zijlstra
2010-05-19 15:38 ` Steven Rostedt
2010-05-19 15:50 ` Peter Zijlstra
2010-05-19 16:08 ` Steven Rostedt
2010-05-19 16:15 ` Peter Zijlstra
2010-05-19 16:27 ` Steven Rostedt
2010-05-19 16:34 ` Peter Zijlstra
2010-05-19 7:14 ` [PATCH 0/5] Optimize perf ring-buffer Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100518133726.128688672@chello.nl \
--to=a.p.zijlstra@chello.nl \
--cc=acme@infradead.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome