Re: [PATCH 5/6] cgroup: implement cgroup v2 thread support
From: Waiman Long
Date: Tue Jul 18 2017 - 10:37:51 EST
On 07/17/2017 04:56 PM, Waiman Long wrote:
> On 07/17/2017 10:14 AM, Peter Zijlstra wrote:
>> On Sun, Jul 16, 2017 at 10:07:20PM -0400, Tejun Heo wrote:
>>> v4: - Updated to marking each cgroup threaded as suggested by PeterZ.
>>>
>>> +On creation, a cgroup is always a domain cgroup and can be made
>>> +threaded by writing "threaded" to the "cgroup.type" file. The
>>> +operation is single direction::
>>> +
>>> + # echo threaded > cgroup.type
>>> +
>>> +Once threaded, the cgroup can't be made a domain again. To enable the
>>> +thread mode, the following conditions must be met.
>>> +
>>> +- As the cgroup will join the parent's resource domain. The parent
>>> + must either be a valid (threaded) domain or a threaded cgroup.
>>> +
>>> +- The cgroup must be empty. No enabled controllers, child cgroups or
>>> + processes.
>>> +
>>> +Topology-wise, a cgroup can be in an invalid state. Please consider
>>> +the following toplogy::
>>> +
>>> + A (threaded domain) - B (threaded) - C (domain, just created)
>>> +
Thinking about it some more. There is a place for invalid domain. It is
not the child of a threaded cgroup. It is the siblings of a threaded
cgroup whose parent is not root.
Root - A (domain) - B (domain)
\ C (domain)
With "echo threaded > B/cgroup.type":
Root - A (threaded domain) - B (threaded)
\ C (domain, invalid)
Any children of a threaded cgroup should be threaded.
Cheers,
Longman