-
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
Conversation
Hi @kolyshkin. Thanks for your PR. I'm waiting for a google member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
No longer a WIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only small nit. Otherwise LGTM
@Creatone thank you for your review! Please advise where should I put the new imports (see my comments above). |
@kolyshkin The second group should be for third-party packages. The last group should have only project packages. |
This is really huge PR. IMHO it would be better to split it to couple of PRs with loosely related commits, e.g. ones depending on import changes could be a separate PR from one(s) that do not have them. Formatting changes would indeed be nice as separate commit for review. |
Draft pending #2962 merge. |
@kolyshkin #2962 was merged so this can be rebased and put out of draft mode? |
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>
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>
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>
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>
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>
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>
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>
307e181
to
c6165e4
Compare
Rebased on top of the current master; no longer a draft. |
@bobbypage needs /retest from you I guess. |
/retest |
Looks like some tests failed in prow run?
|
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>
c6165e4
to
b470b6c
Compare
Yup, lost a trivial hunk due to rebase, fixed now. GHA CI is not catching it for a reason fixed in #2969. Apparently, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
See #2972 |
This is a preparation for bumping opencontainers/runc to 1.1.
Mostly code simplification with some minor improvements along the way.
Please review commit by commit, and see individual commit messages for more details.