• K
    perf/core: Optimize side-band event delivery · f2fb6bef
    Kan Liang 提交于
    The perf_event_aux() function iterates all PMUs and all events in
    their respective per-CPU contexts to find the events to deliver
    side-band records to.
    
    For example, the brk test case in lkp triggers many mmap() operations,
    which, if we're also running perf, results in many perf_event_aux()
    invocations.
    
    If we enable uncore PMU support (even when uncore events are not used),
    dozens of uncore PMUs will be iterated, which can significantly
    decrease brk_test's throughput.
    
    For example, the brk throughput:
    
      without uncore PMUs: 2647573 ops_per_sec
      with    uncore PMUs: 1768444 ops_per_sec
    
    ... a 33% reduction.
    
    To get at the per-CPU events that need side-band records, this patch
    puts these events on a per-CPU list, this avoids iterating the PMUs
    and any events that do not need side-band records.
    
    Per task events are unchanged to avoid extra overhead on the context
    switch paths.
    Suggested-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
    Reported-by: NHuang, Ying <ying.huang@linux.intel.com>
    Signed-off-by: NKan Liang <kan.liang@intel.com>
    Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Link: http://lkml.kernel.org/r/1458757477-3781-1-git-send-email-kan.liang@intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
    f2fb6bef
perf_event.h 38.3 KB