Skip to content

Commit cf7a5be

Browse files
committed
daemon: don't adjust oom-score if score is 0
This patch makes two changes if --oom-score-adj is set to 0 - do not adjust the oom-score-adjust cgroup for dockerd - do not set the hard-coded -999 score for containerd if containerd is running as child process Before this change: oom-score-adj | dockerd | containerd as child-process --------------|---------------|---------------------------- - | -500 | -500 (same as dockerd) -100 | -100 | -100 (same as dockerd) 0 | 0 | -999 (hard-coded default) With this change: oom-score-adj | dockerd | containerd as child-process --------------|---------------|---------------------------- - | -500 | -500 (same as dockerd) -100 | -100 | -100 (same as dockerd) 0 | not adjusted | not adjusted Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 1a5b7f5 commit cf7a5be

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

daemon/daemon_unix.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,9 @@ func setMayDetachMounts() error {
16361636
}
16371637

16381638
func setupOOMScoreAdj(score int) error {
1639+
if score == 0 {
1640+
return nil
1641+
}
16391642
f, err := os.OpenFile("/proc/self/oom_score_adj", os.O_WRONLY, 0)
16401643
if err != nil {
16411644
return err

libcontainerd/supervisor/remote_daemon_linux.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ func (r *remote) setDefaults() {
2828
if r.Debug.Address == "" {
2929
r.Debug.Address = filepath.Join(r.stateDir, debugSockFile)
3030
}
31-
if r.OOMScore == 0 {
32-
r.OOMScore = -999
33-
}
3431

3532
for key, conf := range r.pluginConfs.Plugins {
3633
if conf == nil {

0 commit comments

Comments
 (0)