mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 23:52:40 +00:00
cgroup: remove unnecessary empty check when enabling threaded mode
cgroup_enable_threaded() checks that the cgroup doesn't have any tasks or children and fails the operation if so. This test is unnecessary because the first part is already checked by cgroup_can_be_thread_root() and the latter is unnecessary. The latter actually cause a behavioral oddity. Please consider the following hierarchy. All cgroups are domains. A / \ B C \ D If B is made threaded, C and D becomes invalid domains. Due to the no children restriction, threaded mode can't be enabled on C. For C and D, the only thing the user can do is removal. There is no reason for this restriction. Remove it. Acked-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
7a0cf0e74a
commit
918a8c2c4e
2 changed files with 3 additions and 9 deletions
|
@ -274,8 +274,9 @@ thread mode, the following conditions must be met.
|
||||||
- As the cgroup will join the parent's resource domain. The parent
|
- As the cgroup will join the parent's resource domain. The parent
|
||||||
must either be a valid (threaded) domain or a threaded cgroup.
|
must either be a valid (threaded) domain or a threaded cgroup.
|
||||||
|
|
||||||
- The cgroup must be empty. No enabled controllers, child cgroups or
|
- When the parent is an unthreaded domain, it must not have any domain
|
||||||
processes.
|
controllers enabled or populated domain children. The root is
|
||||||
|
exempt from this requirement.
|
||||||
|
|
||||||
Topology-wise, a cgroup can be in an invalid state. Please consider
|
Topology-wise, a cgroup can be in an invalid state. Please consider
|
||||||
the following toplogy::
|
the following toplogy::
|
||||||
|
|
|
@ -3146,13 +3146,6 @@ static int cgroup_enable_threaded(struct cgroup *cgrp)
|
||||||
!cgroup_can_be_thread_root(dom_cgrp))
|
!cgroup_can_be_thread_root(dom_cgrp))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
/*
|
|
||||||
* Allow enabling thread mode only on empty cgroups to avoid
|
|
||||||
* implicit migrations and recursive operations.
|
|
||||||
*/
|
|
||||||
if (cgroup_has_tasks(cgrp) || css_has_online_children(&cgrp->self))
|
|
||||||
return -EBUSY;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following shouldn't cause actual migrations and should
|
* The following shouldn't cause actual migrations and should
|
||||||
* always succeed.
|
* always succeed.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue