From 7bb73da6b9f19132d7d0747c1fca3b7ef8d8fde2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 2 Apr 2021 12:26:13 +0200 Subject: [PATCH] runtime/v2/shim: remove unused SetScore() and remove sys.OOMScoreMaxKillable The shim.SetScore() utility was no longer used since 7dfc605fc6d36dd7327420b8956ac3f9ac71f190. Checking for uses outside of this repository, I found only one external use of this in gVisor; https://github.com/google/gvisor/blob/a9441aea2780da8c93da1c73da860219f98438de/pkg/shim/service.go#L262-L264 Signed-off-by: Sebastiaan van Stijn --- runtime/v2/shim/util_unix.go | 5 ----- sys/oom_linux.go | 2 -- 2 files changed, 7 deletions(-) diff --git a/runtime/v2/shim/util_unix.go b/runtime/v2/shim/util_unix.go index 9c505707e..f956b0986 100644 --- a/runtime/v2/shim/util_unix.go +++ b/runtime/v2/shim/util_unix.go @@ -46,11 +46,6 @@ func getSysProcAttr() *syscall.SysProcAttr { } } -// SetScore sets the oom score for a process -func SetScore(pid int) error { - return sys.SetOOMScore(pid, sys.OOMScoreMaxKillable) -} - // AdjustOOMScore sets the OOM score for the process to the parents OOM score +1 // to ensure that they parent has a lower* score than the shim // if not already at the maximum OOM Score diff --git a/sys/oom_linux.go b/sys/oom_linux.go index 8e1e3f2f9..6e759a0b1 100644 --- a/sys/oom_linux.go +++ b/sys/oom_linux.go @@ -28,8 +28,6 @@ import ( ) const ( - // OOMScoreMaxKillable is the maximum score keeping the process killable by the oom killer - OOMScoreMaxKillable = -999 // OOMScoreAdjMin is from OOM_SCORE_ADJ_MIN https://github.com/torvalds/linux/blob/v5.10/include/uapi/linux/oom.h#L9 OOMScoreAdjMin = -1000 // OOMScoreAdjMax is from OOM_SCORE_ADJ_MAX https://github.com/torvalds/linux/blob/v5.10/include/uapi/linux/oom.h#L10