mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
vendor: github.com/containerd/cgroup/v3 v3.1.2
- hugetlb: correctly parse hugetlb.<size>.events files - go.mod: github.com/opencontainers/runtime-spec v1.3.0 full diff: https://github.com/containerd/cgroups/compare/v3.1.0...v3.1.2 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
2
go.mod
2
go.mod
@@ -20,7 +20,7 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.58.5
|
||||
github.com/aws/smithy-go v1.23.1
|
||||
github.com/cloudflare/cfssl v1.6.4
|
||||
github.com/containerd/cgroups/v3 v3.1.0
|
||||
github.com/containerd/cgroups/v3 v3.1.2
|
||||
github.com/containerd/containerd/api v1.10.0
|
||||
github.com/containerd/containerd/v2 v2.2.0
|
||||
github.com/containerd/continuity v0.4.5
|
||||
|
||||
4
go.sum
4
go.sum
@@ -132,8 +132,8 @@ github.com/container-storage-interface/spec v1.5.0 h1:lvKxe3uLgqQeVQcrnL2CPQKISo
|
||||
github.com/container-storage-interface/spec v1.5.0/go.mod h1:8K96oQNkJ7pFcC2R9Z1ynGGBB1I93kcS6PGg3SsOk8s=
|
||||
github.com/containerd/accelerated-container-image v1.3.0 h1:sFbTgSuMboeKHa9f7MY11hWF1XxVWjFoiTsXYtOtvdU=
|
||||
github.com/containerd/accelerated-container-image v1.3.0/go.mod h1:EvKVWor6ZQNUyYp0MZm5hw4k21ropuz7EegM+m/Jb/Q=
|
||||
github.com/containerd/cgroups/v3 v3.1.0 h1:azxYVj+91ZgSnIBp2eI3k9y2iYQSR/ZQIgh9vKO+HSY=
|
||||
github.com/containerd/cgroups/v3 v3.1.0/go.mod h1:SA5DLYnXO8pTGYiAHXz94qvLQTKfVM5GEVisn4jpins=
|
||||
github.com/containerd/cgroups/v3 v3.1.2 h1:OSosXMtkhI6Qove637tg1XgK4q+DhR0mX8Wi8EhrHa4=
|
||||
github.com/containerd/cgroups/v3 v3.1.2/go.mod h1:PKZ2AcWmSBsY/tJUVhtS/rluX0b1uq1GmPO1ElCmbOw=
|
||||
github.com/containerd/console v1.0.5 h1:R0ymNeydRqH2DmakFNdmjR2k0t7UPuiOV/N/27/qqsc=
|
||||
github.com/containerd/console v1.0.5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
|
||||
github.com/containerd/containerd/api v1.10.0 h1:5n0oHYVBwN4VhoX9fFykCV9dF1/BvAXeg2F8W6UYq1o=
|
||||
|
||||
5
vendor/github.com/containerd/cgroups/v3/cgroup1/pids.go
generated
vendored
5
vendor/github.com/containerd/cgroups/v3/cgroup1/pids.go
generated
vendored
@@ -47,10 +47,11 @@ func (p *pidsController) Create(path string, resources *specs.LinuxResources) er
|
||||
if err := os.MkdirAll(p.Path(path), defaultDirPerm); err != nil {
|
||||
return err
|
||||
}
|
||||
if resources.Pids != nil && resources.Pids.Limit > 0 {
|
||||
if resources.Pids != nil && resources.Pids.Limit != nil &&
|
||||
*resources.Pids.Limit > 0 {
|
||||
return os.WriteFile(
|
||||
filepath.Join(p.Path(path), "pids.max"),
|
||||
[]byte(strconv.FormatInt(resources.Pids.Limit, 10)),
|
||||
[]byte(strconv.FormatInt(*resources.Pids.Limit, 10)),
|
||||
defaultFilePerm,
|
||||
)
|
||||
}
|
||||
|
||||
33
vendor/github.com/containerd/cgroups/v3/cgroup1/rdma.go
generated
vendored
33
vendor/github.com/containerd/cgroups/v3/cgroup1/rdma.go
generated
vendored
@@ -85,23 +85,26 @@ func parseRdmaKV(raw string, entry *v1.RdmaEntry) {
|
||||
var value uint64
|
||||
var err error
|
||||
|
||||
parts := strings.Split(raw, "=")
|
||||
switch len(parts) {
|
||||
case 2:
|
||||
if parts[1] == "max" {
|
||||
value = math.MaxUint32
|
||||
} else {
|
||||
value, err = parseUint(parts[1], 10, 32)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if parts[0] == "hca_handle" {
|
||||
entry.HcaHandles = uint32(value)
|
||||
} else if parts[0] == "hca_object" {
|
||||
entry.HcaObjects = uint32(value)
|
||||
k, v, found := strings.Cut(raw, "=")
|
||||
if !found {
|
||||
return
|
||||
}
|
||||
|
||||
if v == "max" {
|
||||
value = math.MaxUint32
|
||||
} else {
|
||||
value, err = parseUint(v, 10, 32)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
switch k {
|
||||
case "hca_handle":
|
||||
entry.HcaHandles = uint32(value)
|
||||
case "hca_object":
|
||||
entry.HcaObjects = uint32(value)
|
||||
}
|
||||
}
|
||||
|
||||
func toRdmaEntry(strEntries []string) []*v1.RdmaEntry {
|
||||
|
||||
66
vendor/github.com/containerd/cgroups/v3/cgroup2/utils.go
generated
vendored
66
vendor/github.com/containerd/cgroups/v3/cgroup2/utils.go
generated
vendored
@@ -221,9 +221,9 @@ func ToResources(spec *specs.LinuxResources) *Resources {
|
||||
}
|
||||
resources.HugeTlb = &hugeTlbUsage
|
||||
}
|
||||
if pids := spec.Pids; pids != nil {
|
||||
if pids := spec.Pids; pids != nil && pids.Limit != nil {
|
||||
resources.Pids = &Pids{
|
||||
Max: pids.Limit,
|
||||
Max: *pids.Limit,
|
||||
}
|
||||
}
|
||||
if i := spec.BlockIO; i != nil {
|
||||
@@ -293,6 +293,31 @@ func getStatFileContentUint64(filePath string) uint64 {
|
||||
return res
|
||||
}
|
||||
|
||||
// getKVStatsFileContentUint64 gets uint64 parsed content of key-value cgroup stat file
|
||||
func getKVStatsFileContentUint64(filePath string, propertyName string) uint64 {
|
||||
f, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
s := bufio.NewScanner(f)
|
||||
for s.Scan() {
|
||||
name, value, err := parseKV(s.Text())
|
||||
if name == propertyName {
|
||||
if err != nil {
|
||||
log.L.WithError(err).Errorf("unable to parse %q as a uint from Cgroup file %q", propertyName, filePath)
|
||||
return 0
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
if err = s.Err(); err != nil {
|
||||
log.L.WithError(err).Errorf("error reading Cgroup file %q for property %q", filePath, propertyName)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func readIoStats(path string) []*stats.IOEntry {
|
||||
// more details on the io.stat file format: https://www.kernel.org/doc/Documentation/cgroup-v2.txt
|
||||
var usage []*stats.IOEntry
|
||||
@@ -362,23 +387,26 @@ func parseRdmaKV(raw string, entry *stats.RdmaEntry) {
|
||||
var value uint64
|
||||
var err error
|
||||
|
||||
parts := strings.Split(raw, "=")
|
||||
switch len(parts) {
|
||||
case 2:
|
||||
if parts[1] == "max" {
|
||||
value = math.MaxUint32
|
||||
} else {
|
||||
value, err = parseUint(parts[1], 10, 32)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if parts[0] == "hca_handle" {
|
||||
entry.HcaHandles = uint32(value)
|
||||
} else if parts[0] == "hca_object" {
|
||||
entry.HcaObjects = uint32(value)
|
||||
k, v, found := strings.Cut(raw, "=")
|
||||
if !found {
|
||||
return
|
||||
}
|
||||
|
||||
if v == "max" {
|
||||
value = math.MaxUint32
|
||||
} else {
|
||||
value, err = parseUint(v, 10, 32)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
switch k {
|
||||
case "hca_handle":
|
||||
entry.HcaHandles = uint32(value)
|
||||
case "hca_object":
|
||||
entry.HcaObjects = uint32(value)
|
||||
}
|
||||
}
|
||||
|
||||
func toRdmaEntry(strEntries []string) []*stats.RdmaEntry {
|
||||
@@ -423,7 +451,7 @@ func readHugeTlbStats(path string) []*stats.HugeTlbStat {
|
||||
Max: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".max")),
|
||||
Current: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".current")),
|
||||
Pagesize: pagesize,
|
||||
Failcnt: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".events")),
|
||||
Failcnt: getKVStatsFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".events"), "max"),
|
||||
}
|
||||
}
|
||||
return usage
|
||||
@@ -447,8 +475,8 @@ func hugePageSizes() []string {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer dir.Close()
|
||||
files, err := dir.Readdirnames(0)
|
||||
dir.Close()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -353,7 +353,7 @@ github.com/container-storage-interface/spec/lib/go/csi
|
||||
github.com/containerd/accelerated-container-image/pkg/label
|
||||
github.com/containerd/accelerated-container-image/pkg/types
|
||||
github.com/containerd/accelerated-container-image/pkg/utils
|
||||
# github.com/containerd/cgroups/v3 v3.1.0
|
||||
# github.com/containerd/cgroups/v3 v3.1.2
|
||||
## explicit; go 1.22.0
|
||||
github.com/containerd/cgroups/v3
|
||||
github.com/containerd/cgroups/v3/cgroup1
|
||||
|
||||
Reference in New Issue
Block a user