func NewOOMAdjuster() *OOMAdjuster { … } func getPids(cgroupName string) ([]int, error) { … } // Writes 'value' to /proc/<pid>/oom_score_adj. PID = 0 means self // Returns os.ErrNotExist if the `pid` does not exist. func applyOOMScoreAdj(pid int, oomScoreAdj int) error { … } // Writes 'value' to /proc/<pid>/oom_score_adj for all processes in cgroup cgroupName. // Keeps trying to write until the process list of the cgroup stabilizes, or until maxTries tries. func (oomAdjuster *OOMAdjuster) applyOOMScoreAdjContainer(cgroupName string, oomScoreAdj, maxTries int) error { … }