cgroup: make interface files visible iff enabled on cgroup->subtree_control
authorTejun Heo <tj@kernel.org>
Tue, 8 Jul 2014 22:02:57 +0000 (18:02 -0400)
committerTejun Heo <tj@kernel.org>
Tue, 8 Jul 2014 22:02:57 +0000 (18:02 -0400)
commitf63070d350e3562baa6196f1043e01cd8da2509a
tree79880b53e57b62df7984aaeeb5340d7853e4ace5
parent667c24917144e34880f821486bf0a6e4d05a3a14
cgroup: make interface files visible iff enabled on cgroup->subtree_control

cgroup is implementing support for subsystem dependency which would
require a way to enable a subsystem even when it's not directly
configured through "cgroup.subtree_control".

The preceding patch distinguished cgroup->subtree_control and
->child_subsys_mask where the former is the subsystems explicitly
configured by the userland and the latter is all enabled subsystems
currently is equal to the former but will include subsystems
implicitly enabled through dependency.

Subsystems which are enabled due to dependency shouldn't be visible to
userland.  This patch updates cgroup_subtree_control_write() and
create_css() such that interface files are not created for implicitly
enabled subsytems.

* @visible paramter is added to create_css().  Interface files are
  created only when true.

* If an already implicitly enabled subsystem is turned on through
  "cgroup.subtree_control", the existing css should be used.  css
  draining is skipped.

* cgroup_subtree_control_write() computes the new target
  cgroup->child_subsys_mask and create/kill or show/hide csses
  accordingly.

As the two subsystem masks are still kept identical, this patch
doesn't introduce any behavior changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
include/linux/cgroup.h
kernel/cgroup.c