Set oom score for containerd and shims

This adds a config option to set the oom score for the containerd daemon
as well as automatically setting the oom score for the shim's lauched so
that they are not killed until the very end of an out of memory
condition.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-04-12 11:34:32 -07:00
parent 8d5f8de8ba
commit 634f0c0c83
5 changed files with 47 additions and 0 deletions

View File

@@ -51,6 +51,9 @@ func newShim(path string, remote bool) (shim.ShimClient, error) {
if err := reaper.Default.Start(cmd); err != nil {
return nil, errors.Wrapf(err, "failed to start shim")
}
if err := sys.SetOOMScore(cmd.Process.Pid, sys.OOMScoreMaxKillable); err != nil {
return nil, err
}
return connectShim(socket)
}