Improve oom-killer
This commit is contained in:
@@ -105,6 +105,7 @@ type adaptiveTimer struct {
|
||||
limitThresholds pressureThresholds
|
||||
|
||||
access sync.Mutex
|
||||
cleanupTriggered bool
|
||||
timer *time.Timer
|
||||
state pressureState
|
||||
currentInterval time.Duration
|
||||
@@ -161,10 +162,6 @@ func (t *adaptiveTimer) stop() {
|
||||
}
|
||||
|
||||
func (t *adaptiveTimer) poll() {
|
||||
if t.timerConfig.policyMode == policyModeNetworkExtension {
|
||||
runtimeDebug.FreeOSMemory()
|
||||
}
|
||||
|
||||
var triggered bool
|
||||
var rateTriggered bool
|
||||
sample := readMemorySample(t.policyMode)
|
||||
@@ -174,6 +171,12 @@ func (t *adaptiveTimer) poll() {
|
||||
t.access.Unlock()
|
||||
return
|
||||
}
|
||||
if t.timerConfig.policyMode == policyModeNetworkExtension {
|
||||
if t.cleanupTriggered {
|
||||
runtimeDebug.FreeOSMemory()
|
||||
t.cleanupTriggered = true
|
||||
}
|
||||
}
|
||||
if t.pendingPressureBaseline {
|
||||
t.pressureBaseline = sample
|
||||
t.pressureBaselineTime = time.Now()
|
||||
@@ -205,10 +208,10 @@ func (t *adaptiveTimer) poll() {
|
||||
}
|
||||
}
|
||||
t.access.Unlock()
|
||||
|
||||
if !triggered {
|
||||
return
|
||||
}
|
||||
t.cleanupTriggered = false
|
||||
t.onTriggered(sample.usage)
|
||||
if rateTriggered {
|
||||
if t.killerDisabled {
|
||||
@@ -225,6 +228,7 @@ func (t *adaptiveTimer) poll() {
|
||||
t.router.ResetNetwork()
|
||||
}
|
||||
}
|
||||
badCleanup()
|
||||
runtimeDebug.FreeOSMemory()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user