diff --git a/cgroups/fs/memory.go b/cgroups/fs/memory.go index a2e4f33db9c..b99f81687a6 100644 --- a/cgroups/fs/memory.go +++ b/cgroups/fs/memory.go @@ -56,6 +56,12 @@ func (s *MemoryGroup) Set(path string, cgroup *configs.Cgroup) error { } } + if cgroup.OomKillDisable { + if err := writeFile(path, "memory.oom_control", "1"); err != nil { + return err + } + } + return nil } diff --git a/configs/cgroup.go b/configs/cgroup.go index 92b9286a9ee..8bf174c195f 100644 --- a/configs/cgroup.go +++ b/configs/cgroup.go @@ -51,4 +51,7 @@ type Cgroup struct { // Parent slice to use for systemd TODO: remove in favor or parent Slice string `json:"slice"` + + // Whether to disable OOM Killer + OomKillDisable bool `json:"oom_kill_disable"` }