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

Function getMemorySettings

cgroup1/memory.go:414–451  ·  view source on GitHub ↗
(resources *specs.LinuxResources)

Source from the content-addressed store, hash-verified

412}
413
414func getMemorySettings(resources *specs.LinuxResources) []memorySettings {
415 mem := resources.Memory
416 var swappiness *int64
417 if mem.Swappiness != nil {
418 v := int64(*mem.Swappiness)
419 swappiness = &v
420 }
421 return []memorySettings{
422 {
423 name: "limit_in_bytes",
424 value: mem.Limit,
425 },
426 {
427 name: "soft_limit_in_bytes",
428 value: mem.Reservation,
429 },
430 {
431 name: "memsw.limit_in_bytes",
432 value: mem.Swap,
433 },
434 {
435 name: "kmem.limit_in_bytes",
436 value: mem.Kernel, //nolint:staticcheck // SA1019: mem.Kernel is deprecated
437 },
438 {
439 name: "kmem.tcp.limit_in_bytes",
440 value: mem.KernelTCP,
441 },
442 {
443 name: "oom_control",
444 value: getOomControlValue(mem),
445 },
446 {
447 name: "swappiness",
448 value: swappiness,
449 },
450 }
451}
452
453func getOomControlValue(mem *specs.LinuxMemory) *int64 {
454 if mem.DisableOOMKiller != nil && *mem.DisableOOMKiller {

Callers 2

CreateMethod · 0.85
UpdateMethod · 0.85

Calls 1

getOomControlValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…