]> www.infradead.org Git - users/hch/misc.git/commit
cgroup/freezer: Reduce redundant traversal for cgroup_freeze
authorChen Ridong <chenridong@huawei.com>
Tue, 22 Oct 2024 11:49:45 +0000 (11:49 +0000)
committerTejun Heo <tj@kernel.org>
Wed, 23 Oct 2024 19:45:00 +0000 (09:45 -1000)
commitee1251fc0c4e799a48025318f262739919deb977
treeed3d508feb4e678cc08cffbb510ff75285723fec
parent2190df6c91373fdec6db9fc07e427084f232f57e
cgroup/freezer: Reduce redundant traversal for cgroup_freeze

Whether a cgroup is frozen is determined solely by whether it is set to
to be frozen and whether its parent is frozen. Currently, when is cgroup
is frozen or unfrozen, it iterates through the entire subtree to freeze
or unfreeze its descentdants. However, this is unesessary for a cgroup
that does not change its effective frozen status. This path aims to skip
the subtree if its parent does not have a change in effective freeze.

For an example, subtree like, a-b-c-d-e-f-g, when a is frozen, the
entire tree is frozen. If we freeze b and c again, it is unesessary to
iterate d, e, f and g. So does that If we unfreeze b/c.

Reviewed-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
include/linux/cgroup-defs.h
kernel/cgroup/freezer.c