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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user