MCPcopy Create free account
hub / github.com/containerd/cgroups / hugePageSizes

Function hugePageSizes

cgroup1/utils.go:115–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113}
114
115func hugePageSizes() ([]string, error) {
116 var (
117 pageSizes []string
118 sizeList = []string{"B", "KB", "MB", "GB", "TB", "PB"}
119 )
120 files, err := os.ReadDir("/sys/kernel/mm/hugepages")
121 if err != nil {
122 return nil, err
123 }
124 for _, st := range files {
125 nameArray := strings.Split(st.Name(), "-")
126 pageSize, err := units.RAMInBytes(nameArray[1])
127 if err != nil {
128 return nil, err
129 }
130 pageSizes = append(pageSizes, units.CustomSize("%g%s", float64(pageSize), 1024.0, sizeList))
131 }
132 return pageSizes, nil
133}
134
135func readUint(path string) (uint64, error) {
136 f, err := os.Open(path)

Callers 1

NewHugetlbFunction · 0.70

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…