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

Function OptionalSwap

cgroup1/memory.go:180–187  ·  view source on GitHub ↗

OptionalSwap allows the memory controller to not fail if cgroups is not accounting Swap memory (there are no memory.memsw.* entries)

()

Source from the content-addressed store, hash-verified

178// OptionalSwap allows the memory controller to not fail if cgroups is not accounting
179// Swap memory (there are no memory.memsw.* entries)
180func OptionalSwap() func(*memoryController) {
181 return func(mc *memoryController) {
182 _, err := os.Stat(filepath.Join(mc.root, "memory.memsw.usage_in_bytes"))
183 if os.IsNotExist(err) {
184 mc.ignored["memsw"] = struct{}{}
185 }
186 }
187}
188
189type memoryController struct {
190 root string

Calls 1

StatMethod · 0.65

Used in the wild real call sites across dependent graphs

searching dependent graphs…