cgroups/fs2: make removeCgroupPath faster#2437
Merged
Merged
Conversation
1. In cases there are no sub-cgroups, a single rmdir should be faster than iterating through the list of files. 2. Use unix.Rmdir() to save one more syscall since os.Remove() tries unlink(2) first which fails on a directory, and only then tries rmdir(2). 3. Re-use rmdir. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1. __runc does not set $status, so the check is misleading.
2. Add set +eux to the nest.sh script so we can error out early, and see
what is going on.
3. Doing "echo +io" > cgroup.controllers is giving an error on my
machine ("sh: write error: Operation not supported"). It is probably
fine to just enable pids controller.
4. Add status check for runc exec nest.sh
5. Remove the second check for cgroup.threads contents -- it was already
checked earlier (the output of nest.sh script).
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Contributor
AkihiroSuda
approved these changes
May 29, 2020
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In case there are no sub-cgroups (which is probably a common case), a single rmdir should be faster than iterating through the list of files (as suggested at remove cgroup path recursively in cgroup v2 #2412 (comment))
Use unix.Rmdir() to save one more syscall since os.Remove() tries unlink(2) first which fails on a directory, and only then tries rmdir(2).
Re-use rmdir in the second remove attempt.
And some test case fixups:
__runc does not set $status, so the check is misleading.
Add set +eux to the nest.sh script so we can error out early, and see
what is going on.
Doing "echo +io" > cgroup.controllers is giving an error on my
machine ("sh: write error: Operation not supported"). It is probably
fine to just enable pids controller.
Add status check for runc exec nest.sh
Remove the second check for cgroup.threads contents -- it was already
checked earlier (the output of nest.sh script).
@lifubang PTAL