diff options
author | Tejun Heo <tj@kernel.org> | 2012-11-09 09:12:30 -0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-11-09 10:52:30 -0800 |
commit | ef9fe980c6fcc1821ab955b74b242d2d6585fa75 (patch) | |
tree | 65257977c49732853d36c286ba824fb12f801c53 /lib/gcd.c | |
parent | 5300a9b3482b6d9c32de6d5f4eaeab0fbafa70a8 (diff) | |
download | op-kernel-dev-ef9fe980c6fcc1821ab955b74b242d2d6585fa75.zip op-kernel-dev-ef9fe980c6fcc1821ab955b74b242d2d6585fa75.tar.gz |
cgroup_freezer: implement proper hierarchy support
Up until now, cgroup_freezer didn't implement hierarchy properly.
cgroups could be arranged in hierarchy but it didn't make any
difference in how each cgroup_freezer behaved. They all operated
separately.
This patch implements proper hierarchy support. If a cgroup is
frozen, all its descendants are frozen. A cgroup is thawed iff it and
all its ancestors are THAWED. freezer.self_freezing shows the current
freezing state for the cgroup itself. freezer.parent_freezing shows
whether the cgroup is freezing because any of its ancestors is
freezing.
freezer_post_create() locks the parent and new cgroup and inherits the
parent's state and freezer_change_state() applies new state top-down
using cgroup_for_each_descendant_pre() which guarantees that no child
can escape its parent's state. update_if_frozen() uses
cgroup_for_each_descendant_post() to propagate frozen states
bottom-up.
Synchronization could be coarser and easier by using a single mutex to
protect all hierarchy operations. Finer grained approach was used
because it wasn't too difficult for cgroup_freezer and I think it's
beneficial to have an example implementation and cgroup_freezer is
rather simple and can serve a good one.
As this makes cgroup_freezer properly hierarchical,
freezer_subsys.broken_hierarchy marking is removed.
Note that this patch changes userland visible behavior - freezing a
cgroup now freezes all its descendants too. This behavior change is
intended and has been warned via .broken_hierarchy.
v2: Michal spotted a bug in freezer_change_state() - descendants were
inheriting from the wrong ancestor. Fixed.
v3: Documentation/cgroups/freezer-subsystem.txt updated.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Diffstat (limited to 'lib/gcd.c')
0 files changed, 0 insertions, 0 deletions