> On June 11, 2016, 10:31 p.m., Qian Zhang wrote: > > src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp, line 131 > > <https://reviews.apache.org/r/46158/diff/2/?file=1347650#file1347650line131> > > > > I think there is a special case that we need to handle: In the OS using > > systemd (e.g., RHEL 7.1), `cpu` and `cpuacct` subsystems are co-mounted, > > like this: > > ``` > > ls -la /sys/fs/cgroup/ > > ... > > lrwxrwxrwx. 1 root root 11 Dec 28 15:12 cpu -> cpu,cpuacct > > lrwxrwxrwx. 1 root root 11 Dec 28 15:12 cpuacct -> cpu,cpuacct > > drwxr-xr-x. 4 root root 0 Jan 2 17:01 cpu,cpuacct > > ... > > ``` > > That means in this `hierarchies` hashmap, the values of the two keys > > `cpu` and `cpuacct` are same (both of them are > > `/sys/fs/cgroup/cpu,cpuacct`), this will cause an issue in > > `CgroupsIsolatorProcess::prepare()`: In this method, we will call > > `prepareHierarchy()` which will check if the cgroup for the container to be > > creatd exists or not, if not, create the cgroup, if yes, return an Error. > > For the OS using systemd, I think we will always get the Error since for > > both `cpu` and `cpuacct` subsystems, we will try to create cgroup in the > > same location, i.e., `/sys/fs/cgroup/cpu,cpuacct/mesos/<containerID>`. > > > > You can take a look at the following code in the existing > > `CgroupsCpushareIsolatorProcess` class for how we handle this case. > > https://github.com/apache/mesos/blob/0.28.2/src/slave/containerizer/mesos/isolators/cgroups/cpushare.cpp#L94:L144 > > haosdent huang wrote: > Because we use > ``` > foreach (const string& hierarchy, info->subsystems.keys()) { > ``` > this problem would not happen. > > Suppose both `cpu` and `cpuacct` mount to `/sys/fs/cgroup/cpu,cpuacct`. > The `info->subsystems.keys()` only have one `/sys/fs/cgroup/cpu,cpuacct` here.
Ha, I got it, `multihashmap::keys()` does the trick which will return a `set`, so there will never be two `/sys/fs/cgroup/cpu,cpuacct`, thanks haosdent! - Qian ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/46158/#review136998 ----------------------------------------------------------- On April 16, 2016, 6:14 p.m., haosdent huang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/46158/ > ----------------------------------------------------------- > > (Updated April 16, 2016, 6:14 p.m.) > > > Review request for mesos, Gilbert Song, Guangya Liu, Ian Downes, Jie Yu, and > Kevin Klues. > > > Bugs: MESOS-5041 > https://issues.apache.org/jira/browse/MESOS-5041 > > > Repository: mesos > > > Description > ------- > > Completed implementation of the cgroups unified isolator. > > > Diffs > ----- > > src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp PRE-CREATION > > Diff: https://reviews.apache.org/r/46158/diff/ > > > Testing > ------- > > > Thanks, > > haosdent huang > >
