• Vince Weaver's avatar
    perf_events: Fix perf buffer watermark setting · 4ec8363d
    Vince Weaver authored
    Since 2.6.36 (specifically commit d57e34fd ("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: default avatarVince Weaver <vweaver1@eecs.utk.edu>
    Signed-off-by: default avatarPeter 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.eduSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
    4ec8363d
ring_buffer.c 8.28 KB