do not shoot if MemAvailable > mem_threshold
This commit is contained in:
parent
e8ea4af3a6
commit
bc1bb3c0ea
@ -1909,10 +1909,26 @@ def check_zram_ex():
|
|||||||
return None, None, mem_used_zram
|
return None, None, mem_used_zram
|
||||||
|
|
||||||
|
|
||||||
def check_psi_ex(psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0):
|
def check_psi_ex(psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0,
|
||||||
|
mem_available):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if mem_available <= hard_threshold_min_mem_kb:
|
||||||
|
ma_hard_threshold_exceded = True
|
||||||
|
else:
|
||||||
|
ma_hard_threshold_exceded = False
|
||||||
|
|
||||||
|
if mem_available <= soft_threshold_min_mem_kb:
|
||||||
|
ma_soft_threshold_exceded = True
|
||||||
|
else:
|
||||||
|
ma_soft_threshold_exceded = False
|
||||||
|
|
||||||
|
if mem_available <= warning_threshold_min_mem_kb:
|
||||||
|
ma_warning_threshold_exceded = True
|
||||||
|
else:
|
||||||
|
ma_warning_threshold_exceded = False
|
||||||
|
|
||||||
delta0 = monotonic() - x0
|
delta0 = monotonic() - x0
|
||||||
x0 = monotonic()
|
x0 = monotonic()
|
||||||
|
|
||||||
@ -1945,8 +1961,13 @@ def check_psi_ex(psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
log('mem_avail_hard_threshold_exceded: {}\nmem_avail_soft_threshol'
|
||||||
|
'd_exceded: {}\nmem_avail_warning_threshold_exceeded {}'.format(
|
||||||
|
ma_hard_threshold_exceded, ma_soft_threshold_exceded,
|
||||||
|
ma_warning_threshold_exceded))
|
||||||
|
|
||||||
if (psi_kill_exceeded_timer >= psi_excess_duration and
|
if (psi_kill_exceeded_timer >= psi_excess_duration and
|
||||||
psi_post_action_delay_exceeded):
|
psi_post_action_delay_exceeded and ma_hard_threshold_exceded):
|
||||||
|
|
||||||
mem_info = 'PSI avg ({}) > hard_threshold_max_psi ({})\n' \
|
mem_info = 'PSI avg ({}) > hard_threshold_max_psi ({})\n' \
|
||||||
'PSI avg exceeded psi_excess_duration (value' \
|
'PSI avg exceeded psi_excess_duration (value' \
|
||||||
@ -1977,7 +1998,7 @@ def check_psi_ex(psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (psi_term_exceeded_timer >= psi_excess_duration and
|
if (psi_term_exceeded_timer >= psi_excess_duration and
|
||||||
psi_post_action_delay_exceeded):
|
psi_post_action_delay_exceeded and ma_soft_threshold_exceded):
|
||||||
|
|
||||||
mem_info = 'PSI avg ({}) > soft_threshold_max_psi ({})\n' \
|
mem_info = 'PSI avg ({}) > soft_threshold_max_psi ({})\n' \
|
||||||
'PSI avg exceeded psi_excess_duration (value' \
|
'PSI avg exceeded psi_excess_duration (value' \
|
||||||
@ -1993,7 +2014,8 @@ def check_psi_ex(psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0):
|
|||||||
|
|
||||||
if low_memory_warnings_enabled:
|
if low_memory_warnings_enabled:
|
||||||
|
|
||||||
if psi_avg_value >= warning_threshold_max_psi:
|
if (psi_avg_value >= warning_threshold_max_psi and
|
||||||
|
ma_warning_threshold_exceded):
|
||||||
return ('WARN', None, psi_t0, psi_kill_exceeded_timer,
|
return ('WARN', None, psi_t0, psi_kill_exceeded_timer,
|
||||||
psi_term_exceeded_timer, x0)
|
psi_term_exceeded_timer, x0)
|
||||||
|
|
||||||
@ -2102,7 +2124,8 @@ def implement_corrective_action(
|
|||||||
if CHECK_PSI:
|
if CHECK_PSI:
|
||||||
(psi_threshold, psi_info, psi_t0, psi_kill_exceeded_timer,
|
(psi_threshold, psi_info, psi_t0, psi_kill_exceeded_timer,
|
||||||
psi_term_exceeded_timer, x0) = check_psi_ex(
|
psi_term_exceeded_timer, x0) = check_psi_ex(
|
||||||
psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0)
|
psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0,
|
||||||
|
mem_available)
|
||||||
|
|
||||||
if (masf_threshold is SIGKILL or zram_threshold is SIGKILL or
|
if (masf_threshold is SIGKILL or zram_threshold is SIGKILL or
|
||||||
psi_threshold is SIGKILL):
|
psi_threshold is SIGKILL):
|
||||||
@ -2274,15 +2297,13 @@ def implement_corrective_action(
|
|||||||
elif iva == 1:
|
elif iva == 1:
|
||||||
|
|
||||||
if vwd and d > sensitivity_test_time + 10:
|
if vwd and d > sensitivity_test_time + 10:
|
||||||
log("The victim doesn't respond on corrective action' \
|
log('The victim doesn\'t respond on corrective action'
|
||||||
' in {} sec".format(
|
' in {} sec'.format(round(d, 3)))
|
||||||
round(d, 3)))
|
|
||||||
break
|
break
|
||||||
|
|
||||||
if not vwd and d > sensitivity_test_time:
|
if not vwd and d > sensitivity_test_time:
|
||||||
log("The victim doesn't respond on corrective actio' \
|
log('The victim doesn\'t respond on corrective action'
|
||||||
'n in {} sec".format(
|
' in {} sec'.format(round(d, 3)))
|
||||||
round(d, 3)))
|
|
||||||
break
|
break
|
||||||
|
|
||||||
elif iva == 2:
|
elif iva == 2:
|
||||||
@ -3529,7 +3550,8 @@ while True:
|
|||||||
if CHECK_PSI:
|
if CHECK_PSI:
|
||||||
(psi_threshold, psi_info, psi_t0, psi_kill_exceeded_timer,
|
(psi_threshold, psi_info, psi_t0, psi_kill_exceeded_timer,
|
||||||
psi_term_exceeded_timer, x0) = check_psi_ex(
|
psi_term_exceeded_timer, x0) = check_psi_ex(
|
||||||
psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0)
|
psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0,
|
||||||
|
mem_available)
|
||||||
|
|
||||||
if print_mem_check_results:
|
if print_mem_check_results:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user