[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210413155337.644993-1-namhyung@kernel.org>
Date: Tue, 13 Apr 2021 08:53:35 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>,
Ian Rogers <irogers@...gle.com>,
Song Liu <songliubraving@...com>
Subject: [PATCH v3 0/2] perf core: Sharing events with multiple cgroups
Hello,
This work is to make perf stat more scalable with a lot of cgroups.
Changes in V3)
* fix build error when !CONFIG_CGROUP_PERF
Changes in v2)
* use ____cacheline_aligned macro instead of the padding
* enclose the cgroup node list initialization
* add more comments
* add Acked-by from Song Liu
Currently we need to open a separate perf_event to count an event in a
cgroup. For a big machine, this requires lots of events like
256 cpu x 8 events x 200 cgroups = 409600 events
This is very wasteful and not scalable. In this case, the perf stat
actually counts exactly same events for each cgroup. I think we can
just use a single event to measure all cgroups running on that cpu.
So I added new ioctl commands to add per-cgroup counters to an
existing perf_event and to read the per-cgroup counters from the
event. The per-cgroup counters are updated during the context switch
if tasks' cgroups are different (and no need to change the HW PMU).
It keeps the counters in a hash table with cgroup id as a key.
With this change, average processing time of my internal test workload
which runs tasks in a different cgroup and communicates by pipes
dropped from 11.3 usec to 5.8 usec.
Thanks,
Namhyung
Namhyung Kim (2):
perf/core: Share an event with multiple cgroups
perf/core: Support reading group events with shared cgroups
include/linux/perf_event.h | 22 ++
include/uapi/linux/perf_event.h | 2 +
kernel/events/core.c | 591 ++++++++++++++++++++++++++++++--
3 files changed, 588 insertions(+), 27 deletions(-)
--
2.31.1.295.g9ea45b61b8-goog
*** BLURB HERE ***
Namhyung Kim (2):
perf/core: Share an event with multiple cgroups
perf/core: Support reading group events with shared cgroups
include/linux/perf_event.h | 22 ++
include/uapi/linux/perf_event.h | 2 +
kernel/events/core.c | 594 ++++++++++++++++++++++++++++++--
3 files changed, 591 insertions(+), 27 deletions(-)
base-commit: cface0326a6c2ae5c8f47bd466f07624b3e348a7
--
2.31.1.295.g9ea45b61b8-goog
Powered by blists - more mailing lists