lkml.org 
[lkml]   [2010]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 06/10] perf: Fix wakeup storm for RO mmap()s
    RO mmap()s don't update the tail pointer, so comparing against
    it for determining the written data size doesn't really do any good.

    Keep track of when we last did a wakeup, and compare against that.

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

    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
    @@ -599,7 +599,7 @@ struct perf_mmap_data {
    local_t head; /* write position */
    local_t nest; /* nested writers */
    local_t events; /* event limit */
    - local_t wakeup; /* needs a wakeup */
    + local_t wakeup; /* wakeup stamp */
    local_t lost; /* nr records lost */

    long watermark; /* wakeup watermark */
    Index: linux-2.6/kernel/perf_event.c
    ===================================================================
    --- linux-2.6.orig/kernel/perf_event.c
    +++ linux-2.6/kernel/perf_event.c
    @@ -3055,8 +3055,8 @@ int perf_output_begin(struct perf_output
    handle->offset = offset;
    handle->head = head;

    - if (head - tail > data->watermark)
    - local_inc(&data->wakeup);
    + if (head - local_read(&data->wakeup) > data->watermark)
    + local_add(data->watermark, &data->wakeup);

    if (have_lost) {
    lost_event.header.type = PERF_RECORD_LOST;



    \
     
     \ /
      Last update: 2010-05-21 11:15    [W:0.024 / U:0.556 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site