lkml.org 
[lkml]   [2011]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] perf_events: fix perf buffer watermark setting

Since 2.6.36 (specifically commit d57e34fdd60be7ffd0b1d86bfa1a553df86b7172)
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.

Signed-off-by: Vince Weaver <vweaver1@eecs.utk.edu>


diff --git a/kernel/events/core.c b/kernel/events/core.c
index d863b3c..b949661 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3787,7 +3787,8 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
if (vma->vm_flags & VM_WRITE)
flags |= PERF_BUFFER_WRITABLE;

- buffer = perf_buffer_alloc(nr_pages, event->attr.wakeup_watermark,
+ buffer = perf_buffer_alloc(nr_pages,
+ event->attr.watermark?event->attr.wakeup_watermark:0,
event->cpu, flags);
if (!buffer) {
ret = -ENOMEM;

\
 
 \ /
  Last update: 2011-06-01 21:19    [W:0.042 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site