From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Stephane Eranian <eranian@google.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org, Tejun Heo <tj@kernel.org>,
Li Zefan <lizefan@huawei.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCHSET 00/10] perf: Improve cgroup profiling (v5)
Date: Fri, 6 Mar 2020 16:05:14 +0100 [thread overview]
Message-ID: <20200306150514.GE290743@krava> (raw)
In-Reply-To: <20200224043749.69466-1-namhyung@kernel.org>
On Mon, Feb 24, 2020 at 01:37:39PM +0900, Namhyung Kim wrote:
> Hello,
>
> This work is to improve cgroup profiling in perf. Currently it only
> supports profiling tasks in a specific cgroup and there's no way to
> identify which cgroup the current sample belongs to. So I added
> PERF_SAMPLE_CGROUP to add cgroup id into each sample. It's a 64-bit
> integer having file handle of the cgroup. And kernel also generates
> PERF_RECORD_CGROUP event for new groups to correlate the cgroup id and
> cgroup name (path in the cgroup filesystem). The cgroup id can be
> read from userspace by name_to_handle_at() system call so it can
> synthesize the CGROUP event for existing groups.
>
> So why do we want this? Systems running a large number of jobs in
> different cgroups want to profiling such jobs precisely. This includes
> container hosting systems widely used today. Currently perf supports
> namespace tracking but the systems may not use (cgroup) namespace for
> their jobs. Also it'd be more intuitive to see cgroup names (as
> they're given by user or sysadmin) rather than numeric
> cgroup/namespace id even if they use the namespaces.
>
> From Stephane Eranian:
> > In data centers you care about attributing samples to a job not such
> > much to a process. A job may have multiple processes which may come
> > and go. The cgroup on the other hand stays around for the entire
> > lifetime of the job. It is much easier to map a cgroup name to a
> > particular job than it is to map a pid back to a job name,
> > especially for offline post-processing.
>
> Note that this only works for "perf_event" cgroups (obviously) so if
> users are still using cgroup-v1 interface, they need to have same
> hierarchy for subsystem(s) want to profile with it.
>
> * Changes from v4:
> - use CONFIG_CGROUP_PERF
> - move cgroup tree to perf_env
> - move cgroup fs utility function to tools/lib/api/fs
> - use a local buffer and check its size for cgroup systhesis
the perf top tui should all cgroup id as 0 and the headers are
misaligned
Samples
Overhead cgroup id (dev/inode Pid:Command
83.78% 0/0x0 N/A 6508:perf
8.82% 0/0x0 N/A 0:swapper
2.59% 0/0x0 N/A 6466:perf
1.69% 0/0x0 N/A 6509:perf-top-UI
0.56% 0/0x0 N/A 12:rcu_sched
0.29% 0/0x0 N/A 429:kworker/0:2-mm_
0.15% 0/0x0 N/A 1416:sshd
0.12% 0/0x0 N/A 187:migration/35
jirka
next prev parent reply other threads:[~2020-03-06 15:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 4:37 [PATCHSET 00/10] perf: Improve cgroup profiling (v5) Namhyung Kim
2020-02-24 4:37 ` [PATCH 01/10] perf/core: Add PERF_RECORD_CGROUP event Namhyung Kim
2020-02-24 4:37 ` [PATCH 02/10] perf/core: Add PERF_SAMPLE_CGROUP feature Namhyung Kim
2020-02-24 4:37 ` [PATCH 03/10] tools lib api fs: Move cgroupsfs__mountpoint() Namhyung Kim
2020-02-24 4:37 ` [PATCH 04/10] perf tools: Basic support for CGROUP event Namhyung Kim
2020-02-24 4:37 ` [PATCH 05/10] perf tools: Maintain cgroup hierarchy Namhyung Kim
2020-02-24 4:37 ` [PATCH 06/10] perf report: Add 'cgroup' sort key Namhyung Kim
2020-03-06 14:10 ` Jiri Olsa
2020-02-24 4:37 ` [PATCH 07/10] perf record: Support synthesizing cgroup events Namhyung Kim
2020-03-06 14:14 ` Jiri Olsa
2020-03-06 14:15 ` Jiri Olsa
2020-02-24 4:37 ` [PATCH 08/10] perf record: Add --all-cgroups option Namhyung Kim
2020-02-24 4:37 ` [PATCH 09/10] perf top: " Namhyung Kim
2020-02-24 4:37 ` [PATCH 10/10] perf script: Add --show-cgroup-events option Namhyung Kim
2020-03-06 15:05 ` Jiri Olsa [this message]
2020-03-22 23:58 ` [PATCHSET 00/10] perf: Improve cgroup profiling (v5) Namhyung Kim
2020-03-24 16:34 ` Tejun Heo
2020-03-24 20:15 ` Peter Zijlstra
2020-03-24 21:24 ` Arnaldo Melo
2020-03-25 10:24 ` Namhyung Kim
2020-03-25 12:17 ` Arnaldo Carvalho de Melo
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=20200306150514.GE290743@krava \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tj@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).