-
Notifications
You must be signed in to change notification settings - Fork 58
Add support for creating subfolders in cgroupv2 #144
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
base: main
Are you sure you want to change the base?
Add support for creating subfolders in cgroupv2 #144
Conversation
|
@Tim-Zhang any chance for a review? |
|
@DanielShaulov, please, could you make sure we have the Clippy Check happy? |
9f0c2d3 to
5324d1b
Compare
|
@fidencio fixed - can you approve the workflow please? |
|
@DanielShaulov sorry, I have't been paying attention to this repo recently. how about resolving the confit first? |
|
@Tim-Zhang - done, and |
|
@DanielShaulov Please rebase your code, we don't allow merge commits. |
7c33adf to
fa9276d
Compare
|
@justxuewei done |
|
Close for triggering the CI |
|
@justxuewei PTAL and there still are some problems with the CI @DanielShaulov |
| }) | ||
| .collect::<Vec<_>>(); | ||
|
|
||
| let rp = relative_paths.get("").unwrap(); |
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.
How can we assume the key "" always exists? if the user don't get relative_paths by calling get_cgroups_relative_paths or the code run on cgroups v1, it may be panic here.
The first commit adds cgroup v2 support for
load_with_relative_paths- sinceget_cgroups_relative_pathsalready stores the path for the unified hierarchy in cgroup v2 under the empty""key - we can look that key up inload_with_relative_pathsand prepend it to the passed path for all subsystems and for the "path" field in the Cgroup struct itself.Some other changes in
load_with_relative_pathsare:path- to create a cgroup that represents the "current" cgroup if used with the relative paths fromget_cgroups_relative_pathsThe second commit adds the ability to "create" a cgroupv2 hierarchy without enabling subtree_control. This is crucial, because in cgroupv2, due to the rule that processes can only appear in leafs, if you want to create a subdirectory of existing cgroup with a process in it you need the following order of operations:
So with the changes in this PR - the following code creates a directory "foo" under the existing cgroup, moves all processes from current cgroup into "foo" and then enables subtree_control on the parent.
If this is merged I will open another PR for Builder to expose this from builder as well.