From: Namhyung Kim <namhyung@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@redhat.com>, Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Stephane Eranian <eranian@google.com>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
Song Liu <songliubraving@fb.com>
Subject: [RFC 0/2] perf core: Sharing events with multiple cgroups
Date: Wed, 24 Mar 2021 01:21:54 +0900 [thread overview]
Message-ID: <20210323162156.1340260-1-namhyung@kernel.org> (raw)
Hello,
This work is to make perf stat more scalable with a lot of cgroups.
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 | 588 ++++++++++++++++++++++++++++++--
3 files changed, 585 insertions(+), 27 deletions(-)
--
2.31.0.rc2.261.g7f71774620-goog
next reply other threads:[~2021-03-23 16:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-23 16:21 Namhyung Kim [this message]
2021-03-23 16:21 ` [PATCH 1/2] perf/core: Share an event with multiple cgroups Namhyung Kim
2021-03-24 0:30 ` Song Liu
2021-03-24 1:06 ` Namhyung Kim
2021-03-25 0:55 ` Song Liu
2021-03-25 2:44 ` Namhyung Kim
2021-03-25 12:57 ` Arnaldo Carvalho de Melo
2021-03-28 17:17 ` Song Liu
2021-03-29 11:33 ` Namhyung Kim
2021-03-30 6:33 ` Song Liu
2021-03-30 15:11 ` Namhyung Kim
2021-04-01 6:00 ` Stephane Eranian
2021-04-01 6:19 ` Song Liu
2021-03-23 16:21 ` [PATCH 2/2] perf/core: Support reading group events with shared cgroups Namhyung Kim
2021-03-28 17:31 ` Song Liu
2021-03-29 11:36 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210323162156.1340260-1-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox