Skip to content
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

Handle threaded cgroup types #4168

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion libcontainer/cgroups/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
)

const (
CgroupType = "cgroup.type"
CgroupProcesses = "cgroup.procs"
CgroupThreads = "cgroup.threads"
Comment on lines +21 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are using public names here. Do you want to use these constants from other packages?

unifiedMountpoint = "/sys/fs/cgroup"
hybridMountpoint = "/sys/fs/cgroup/unified"
)
Expand Down Expand Up @@ -137,7 +139,14 @@
}

func readProcsFile(dir string) ([]int, error) {
f, err := OpenFile(dir, CgroupProcesses, os.O_RDONLY)
var procsFile = CgroupProcesses

Check failure on line 142 in libcontainer/cgroups/utils.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)

cgrouptype, err := ReadFile(dir, CgroupType)
if err == nil && string(cgrouptype) == "threaded\n" {

Check failure on line 145 in libcontainer/cgroups/utils.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary conversion (unconvert)
procsFile = CgroupThreads
}

f, err := OpenFile(dir, procsFile, os.O_RDONLY)
if err != nil {
return nil, err
}
Expand Down