> On July 25, 2016, 1:46 p.m., Qian Zhang wrote:
> > src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp, lines 82-86
> > <https://reviews.apache.org/r/49814/diff/12/?file=1451776#file1451776line82>
> >
> > I think besides preparing the hierarchy, we also need to ensure no
> > other subsystem is attached to the hierarchy, see the following code as an
> > example:
> >
> > https://github.com/apache/mesos/blob/1.0.0-rc4/src/slave/containerizer/mesos/isolators/cgroups/mem.cpp#L95:L105
> >
> > Maybe you can do it in each subsystem's `load()` method.
>
> haosdent huang wrote:
> We don't need add this check because there may be multiple subsystems
> attach to a same hierarchy. For example, if `cpu` and `cpuacct` attached to
> the same hierarchy `/a`, this check would failed.
>
> Qian Zhang wrote:
> Understood, but I think we should still be able to handle that case with
> the code below in the `load()` method of both `cpu` and `cpuacct` subsystems:
> ```
> // Ensure that no other subsystem is attached to the hierarchy.
> Try<set<string>> _subsystems = cgroups::subsystems(hierarchy.get());
> if (_subsystems.isError()) {
> return Error(
> "Failed to get the list of attached subsystems for hierarchy " +
> hierarchy.get());
> } else if (_subsystems.get().size() != 1) {
> foreach (const string& subsystem, subsystems.get()) {
> if (subsystem != "cpu" && subsystem != "cpuacct") {
> return Error(
> "Unexpected subsystems found attached to the hierarchy " +
> hierarchy.get());
> }
> }
> ```
>
> You can take a look at the following code as an reference:
>
> https://github.com/apache/mesos/blob/1.0.0-rc4/src/slave/containerizer/mesos/isolators/cgroups/net_cls.cpp#L267:L273
>
> haosdent huang wrote:
> Still could not, suppose this case, we mount `cpu`, `cpuacct`, `memory`
> on the same hierarchy path `/a`. Then the check above would fail.
>
> Qian Zhang wrote:
> I see, you are talking about cgroup v2 that we are going to support in
> future, right?
No, we could do it no matter cgroup-v1 or cgroup-v2. For example,
```
# Clear the enviroment.
[root@localhost tmp]# cgclear
# Mount `cpuacct,cpu,memory` in the same hierarchy.
[root@localhost tmp]# mount -t cgroup -o 'cpuacct,cpu,memory' cgroup /tmp/a
# Verfied that `cpuacct,cpu,memory` mount successfully.
[root@localhost tmp]# cat /proc/mounts |grep cpuacct
cgroup /tmp/a cgroup rw,relatime,memory,cpuacct,cpu 0 0
[root@localhost tmp]# ls /tmp/a
cgroup.event_control cpuacct.usage_percpu cpu.rt_runtime_us
memory.force_empty memory.memsw.limit_in_bytes memory.oom_control
memory.usage_in_bytes tasks
cgroup.procs cpu.cfs_period_us cpu.shares
memory.limit_in_bytes memory.memsw.max_usage_in_bytes
memory.soft_limit_in_bytes memory.use_hierarchy
cpuacct.stat cpu.cfs_quota_us cpu.stat
memory.max_usage_in_bytes memory.memsw.usage_in_bytes memory.stat
notify_on_release
cpuacct.usage cpu.rt_period_us memory.failcnt
memory.memsw.failcnt memory.move_charge_at_immigrate memory.swappiness
release_agent
```
- haosdent
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/49814/#review143375
-----------------------------------------------------------
On July 25, 2016, 2:35 a.m., haosdent huang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49814/
> -----------------------------------------------------------
>
> (Updated July 25, 2016, 2:35 a.m.)
>
>
> Review request for mesos, Gilbert Song, Jie Yu, Qian Zhang, and Zhengju Sha.
>
>
> Bugs: MESOS-5041
> https://issues.apache.org/jira/browse/MESOS-5041
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Implemented `CgroupsIsolatorProcess::create`.
>
>
> Diffs
> -----
>
> src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
> 4a9f55bf3b217405bf90943f27a976422877a99e
>
> Diff: https://reviews.apache.org/r/49814/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> haosdent huang
>
>