-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
libct/cgroup: rm GetClosestMountpointAncestor using moby/sys/mountinfo parser #2401
Conversation
This function is not very efficient, does not really belong to cgroup package, and is only used once (from fs/cpuset.go). Prepare to remove it by replacing with the implementation based on the parser from github.com/moby/sys/mountinfo parser. This commit is here to make sure the proposed replacement passes the unit test. Funny, but the unit test need to be slightly modified since it supplies the wrong mountinfo (space as the first character, empty line at the end). Validated by $ go test -v -run Ance === RUN TestGetClosestMountpointAncestor --- PASS: TestGetClosestMountpointAncestor (0.00s) PASS ok github.com/opencontainers/runc/libcontainer/cgroups 0.002s Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The function GetClosestMountpointAncestor is not very efficient, does not really belong to cgroup package, and is only used once (from fs/cpuset.go). Remove it, replacing with the implementation based on moby/sys/mountinfo parser. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
OK, CI passed, adding the second commit |
I quickly checked Docker and libpod sources -- this function is not used in there. |
@AkihiroSuda @mrunalp PTAL |
There is no need to mess with mountinfo for cgroup v2 case, and I don't think we'll make any major changes to cgroup v1 (except I'm still tinkering with how to decrease the ridiculous number of times we parse /proc/self/mountinfo). |
The compilation error had ocurred because of a bad rebase during opencontainers#2401 and opencontainers#2413 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
The function
GetClosestMountpointAncestor
is not very efficient,does not really belong to cgroup package, and is only used once
(from fs/cpuset.go).
The removal is done in two stages/commits:
1
Prepare to remove it by replacing with the implementation based on
the
github.com/moby/sys/mountinfo
parser.This commit is here to make sure the proposed replacement passes the
unit test.
Funny, but the unit test need to be slightly modified since it
supplies the wrong mountinfo (space as the first character, empty line
at the end).
Validated by
2
Actually remove
GetClosestMountpointAncestor
, move the replacementcode to
libcontainer/cgroups/fs/cpuset.go
.