• Kan Liang's avatar
    perf/core: Optimize side-band event delivery · f2fb6bef
    Kan Liang authored
    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: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Reported-by: default avatarHuang, Ying <ying.huang@linux.intel.com>
    Signed-off-by: default avatarKan Liang <kan.liang@intel.com>
    Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@kernel.org>
    f2fb6bef
core.c 245 KB