diff options
author | Vince Weaver <vweaver1@eecs.utk.edu> | 2011-06-01 21:15:36 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-07-01 11:06:32 +0200 |
commit | 4ec8363dfc1451f8c8f86825731fe712798ada02 (patch) | |
tree | 12db5b26a3ffa179ef119ac945c4d9a6fb1ced88 /kernel/events/ring_buffer.c | |
parent | irq_work, alpha: Fix up arch hooks (diff) | |
download | linux-4ec8363dfc1451f8c8f86825731fe712798ada02.tar.xz linux-4ec8363dfc1451f8c8f86825731fe712798ada02.zip |
perf_events: Fix perf buffer watermark setting
Since 2.6.36 (specifically commit d57e34fdd60b ("perf: Simplify the
ring-buffer logic: make perf_buffer_alloc() do everything needed"),
the perf_buffer_init_code() has been mis-setting the buffer watermark
if perf_event_attr.wakeup_events has a non-zero value.
This is because perf_event_attr.wakeup_events is a union with
perf_event_attr.wakeup_watermark.
This commit re-enables the check for perf_event_attr.watermark being
set before continuing with setting a non-default watermark.
This bug is most noticable when you are trying to use PERF_IOC_REFRESH
with a value larger than one and perf_event_attr.wakeup_events is set to
one. In this case the buffer watermark will be set to 1 and you will
get extraneous POLL_IN overflows rather than POLL_HUP as expected.
[ avoid using attr.wakeup_events when attr.watermark is set ]
Signed-off-by: Vince Weaver <vweaver1@eecs.utk.edu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.00.1106011506390.5384@cl320.eecs.utk.edu
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/events/ring_buffer.c')
-rw-r--r-- | kernel/events/ring_buffer.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index fde52595d8f7..fc2701c99207 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -199,13 +199,15 @@ void perf_output_end(struct perf_output_handle *handle) struct perf_event *event = handle->event; struct ring_buffer *rb = handle->rb; - int wakeup_events = event->attr.wakeup_events; - - if (handle->sample && wakeup_events) { - int events = local_inc_return(&rb->events); - if (events >= wakeup_events) { - local_sub(wakeup_events, &rb->events); - local_inc(&rb->wakeup); + if (handle->sample && !event->attr.watermark) { + int wakeup_events = event->attr.wakeup_events; + + if (wakeup_events) { + int events = local_inc_return(&rb->events); + if (events >= wakeup_events) { + local_sub(wakeup_events, &rb->events); + local_inc(&rb->wakeup); + } } } |