[PATCHSET] cgroup, perf_event: make perf_event work on v2 hierarchy
From: Tejun Heo
Date: Thu Jan 07 2016 - 17:32:31 EST
Hello,
perf_event is special in that while it primarily is there to identify
cgroup membership of tasks, it also keeps some per-cgroup state, so
unlike other controllers which are purely for identification, it can't
be replaced by v2 hierarchy membership tests. At the same time, as it
is primarily used for tagging, doesn't incur meaningful runtime
overhead and doesn't have any interface, it's awkward to control it
via the usual "cgroup.subtree_control" mechanism on the v2 hierarchy.
This patchset makes perf_event implicitly enabled on the v2 hierarchy
so that cgroup v2 path automatically works with "perf record --cgroup"
as long as perf_event controller is available and not mounted on a
legacy hierarchy. "perf record" is updated so that it searches for
both v1 hierarchy w/ perf_event on it and v2 hierarchy. The v1
hierarchy is used if exists; otherwise, v2 is used, making the
transition transparent to users.
This patchset contains the following six patches.
0001-cgroup-s-cgrp_dfl_root_-cgrp_dfl_.patch
0002-cgroup-convert-cgroup_subsys-flag-fields-to-bool-bit.patch
0003-cgroup-make-css_tryget_online_from_dir-also-recogniz.patch
0004-cgroup-use-subtree_control-when-testing-no-internal-.patch
0005-cgroup-implement-cgroup_subsys-implicit_on_dfl.patch
0006-cgroup-perf_event-make-perf_event-controller-work-on.patch
0001-0004 are prep patches.
0005 implents implicit controller enabling.
0006 marks perf_event as implicitly enabled on v2 and updates "perf
record"
This patchset is on top of cgroup/for-4.5 and available in the
following git branch.
git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-cgroup2-perf_event
diffstat follows. Thanks.
Documentation/cgroup.txt | 13 ++++
include/linux/cgroup-defs.h | 21 ++++++-
kernel/cgroup.c | 129 ++++++++++++++++++++++++++++++++++----------
kernel/cpuset.c | 2
kernel/events/core.c | 6 ++
kernel/sched/core.c | 2
kernel/sched/cpuacct.c | 2
tools/perf/util/cgroup.c | 26 ++++++--
8 files changed, 160 insertions(+), 41 deletions(-)
--
tejun