-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cgroup cleanups #2959
cgroup cleanups #2959
Commits on Oct 21, 2021
-
container: remove Mounts from CgroupSubsystems
This field is only used - to check if there are any mounts, i.e. len() == 0; - to iterate over the list of mounts in watcher. In both cases, we can reuse MountPoints without any degradation. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 591efd8 - Browse repository at this point
Copy the full SHA 591efd8View commit details -
container: rm cgroupFilesystems from rawContainerWatcher
cgroupPaths was basically a copy of cgroupSubsystems.MountPoints. This is because it was produced from the elements of the latter by calling common.MakeCgroupPaths() with the second argument of "/". Note that path.Join(something, "/") will return something. Since we have two copies of the same info, let's remove one and reuse the other. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 02d9fb2 - Browse repository at this point
Copy the full SHA 02d9fb2View commit details -
Convert CgroupPaths from struct to map
As this structure only have 1 element now, it does not make sense to have it as a structure. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for d03222e - Browse repository at this point
Copy the full SHA d03222eView commit details -
container: rm CgroupSubsystems type
Replace it with map[string]string, which it is. This is a continuation of the previous commit, separated out for review clarity. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for ea2b951 - Browse repository at this point
Copy the full SHA ea2b951View commit details -
container: GetCgroupSubsystems: simplify
Instead of creating an intermediate map to remove specific mounts based on MetricSet, amend the supportedSubsystems map to have information about which subsystem reports which metrics. Based on that info, the check whether the subsystem is needed or not becomes much simpler. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for ca997e3 - Browse repository at this point
Copy the full SHA ca997e3View commit details -
container: rm libcontainer.GetAllCgroupSubsystems
It is equivalent to GetCgroupSubsystems(nil) which is easy to use, and there's only one user. Remove the function, patch the user. While at it, document the includeMetrics argument of GetCgroupSubsystems. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 891811e - Browse repository at this point
Copy the full SHA 891811eView commit details -
container/libcontainer: simplify for cgroup v2
In case of cgroup v2, there are no separate per-subsystem mount points, and so it does not make sense to have a subsystem to mountpoint map. Yet for the unification of code between v1 and v2, we still use this map, although a single element is enough. For cgroup v2, the key is "", the value is the mount point (or the path to a specific cgroup). This commit - simplifes GetCgroupSubsystems for cgroup v2 (trivial) case; - modifies GetCgroupPath() methods to use "" as the key for cgroup v2; - fixes NewCgroupManager() to use "" as the key for cgroup v2 case. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 1571e28 - Browse repository at this point
Copy the full SHA 1571e28View commit details -
manager: simplify createContainer
The code to initialize perf collector is almost the same between cgroup v1 and v2, the only difference is how we get cgroup path. Since now GetCgroupPath is v2 ready, we can use it, and thus unify these two cases. This commit is best reviewed with --ignore-space-change. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for b470b6c - Browse repository at this point
Copy the full SHA b470b6cView commit details