Merge pull request #724 from crosbymichael/oom-score

Set oom score for containerd and shims
This commit is contained in:
Phil Estes
2017-04-12 15:41:23 -04:00
committed by GitHub
5 changed files with 47 additions and 0 deletions

View File

@@ -53,6 +53,8 @@ type config struct {
Plugins map[string]toml.Primitive `toml:"plugins"`
// Enable containerd as a subreaper
Subreaper bool `toml:"subreaper"`
// OOMScore adjust the containerd's oom score
OOMScore int `toml:"oom_score"`
md toml.MetaData
}

View File

@@ -29,6 +29,12 @@ func platformInit(context *cli.Context) error {
return err
}
}
if conf.OOMScore != 0 {
log.G(global).Infof("changing OOM score to %d", conf.OOMScore)
if err := sys.SetOOMScore(os.Getpid(), conf.OOMScore); err != nil {
return err
}
}
return nil
}