[PATCH v6 0/3] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi
From: Alexey Budankov
Date: Wed Aug 02 2017 - 04:11:35 EST
By default, the userspace perf tool opens per-cpu task-bound events
when sampling, so for N logical events requested by the user, the tool
will open N * NR_CPUS events.
In the kernel, we mux events with a hrtimer, periodically rotating the
flexible group list and trying to schedule each group in turn. We skip
groups whose cpu filter doesn't match. So when we get unlucky, we can
walk N * (NR_CPUS - 1) groups pointlessly for each hrtimer invocation.
This has been observed to result in significant overhead when running
the STREAM benchmark on 272 core Xeon Phi systems.
One way to avoid this is to place our events into an rb tree sorted by
CPU, so that our hrtimer can skip to the current CPU's list and ignore
This patch set moves event groups into rb trees and implements
skipping to the current CPU's list on hrtimer interrupt.
The patch set was tested on Xeon Phi using perf_fuzzer and tests
from here: https://github.com/deater/perf_event_tests
Patches in the set are expected to be applied one after another in
the mentioned order and they are logically split here into three parts
to simplify the review process.
Alexey Budankov (3):
perf/core: use rb trees for pinned/flexible groups
perf/core: use context tstamp_data for skipped events on mux interrupt
perf/core: add mux switch to skip to the current CPU's events list on mux interrupt
include/linux/perf_event.h | 54 +++--
kernel/events/core.c | 584 +++++++++++++++++++++++++++++++++------------
2 files changed, 473 insertions(+), 165 deletions(-)