cgroups: add support for oom control

This patch add support for diable OOM Killer.

Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
HuKeping 2015-03-07 02:37:56 +08:00
parent 334b196371
commit 295c70865d
2 changed files with 9 additions and 0 deletions

View File

@ -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
}

View File

@ -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"`
}