print reaction time if victim got signal

This commit is contained in:
Alexey Avramov 2018-07-12 03:21:53 +09:00
parent 53dbd40128
commit 9d888e794a
3 changed files with 33 additions and 8 deletions

View File

@ -32,11 +32,29 @@ OOM killer doesn't prevent OOM conditions.
### An example of output ### An example of output
``` ```
MemAvailable (0 MiB, 0.0 %) < mem_min_sigterm (588 MiB, 10.0 %) MemAvail: 2515 M, 42.8 %
SwapFree (943 MiB, 8.8 %) < swap_min_sigterm (1076 MiB, 10.0 %) MemAvail: 1510 M, 25.7 %
Preventing OOM: trying to send the SIGTERM signal to tail, MemAvail: 909 M, 15.5 %
Pid: 14636, Badness: 777, VmRSS: 4446 MiB, VmSwap: 8510 MiB MemAvail: 520 M, 8.9 %
Success * MemAvailable (520 MiB, 8.9 %) < mem_min_sigterm (529 MiB, 9.0 %)
SwapFree (0 MiB, 0.0 %) < swap_min_sigterm (0 MiB, - %)
Preventing OOM: trying to send the SIGTERM signal to stress,
Pid: 9828, Badness: 82, VmRSS: 485 MiB, VmSwap: 0 MiB
Success; reaction time: 11 ms
MemAvail: 4114 M, 70.0 %
MemAvail: 2532 M, 43.1 %
MemAvail: 1495 M, 25.4 %
MemAvail: 927 M, 15.8 %
MemAvail: 553 M, 9.4 %
MemAvail: 342 M, 5.8 %
* MemAvailable (342 MiB, 5.8 %) < mem_min_sigkill (353 MiB, 6.0 %)
SwapFree (0 MiB, 0.0 %) < swap_min_sigkill (0 MiB, - %)
Preventing OOM: trying to send the SIGKILL signal to stress,
Pid: 9841, Badness: 87, VmRSS: 513 MiB, VmSwap: 0 MiB
Success; reaction time: 11 ms
MemAvail: 4084 M, 69.5 %
MemAvail: 2543 M, 43.3 %
MemAvail: 1535 M, 26.1 %
``` ```
### Requirements ### Requirements

9
nohang
View File

@ -229,6 +229,8 @@ def sleep_after_send_signal(signal):
def find_victim_and_send_signal(signal): def find_victim_and_send_signal(signal):
time0 = time()
print(mem_info) print(mem_info)
# выставляем потолок для oom_score_adj всех процессов # выставляем потолок для oom_score_adj всех процессов
@ -326,7 +328,9 @@ def find_victim_and_send_signal(signal):
try: try:
os.kill(int(pid), signal) os.kill(int(pid), signal)
send_result = ' Success' success_time = time()
delta_success = success_time - time0
send_result = ' Success; reaction time: {} ms'.format(round(delta_success * 1000))
if desktop_notifications: if desktop_notifications:
send_notify(signal, name, pid, oom_score, vm_rss, vm_swap) send_notify(signal, name, pid, oom_score, vm_rss, vm_swap)
@ -1247,6 +1251,7 @@ while True:
break break
# если swap_min_sigkill задан в процентах # если swap_min_sigkill задан в процентах
if swap_kill_is_percent: if swap_kill_is_percent:
swap_min_sigkill_kb = swap_total * swap_min_sigkill_percent / 100.0 swap_min_sigkill_kb = swap_total * swap_min_sigkill_percent / 100.0
@ -1396,8 +1401,10 @@ while True:
warn_timer = 0 warn_timer = 0
sleep_after_check_mem() sleep_after_check_mem()
# SLEEP BETWEEN MEM CHECKS # SLEEP BETWEEN MEM CHECKS
else: else:
sleep_after_check_mem() sleep_after_check_mem()

View File

@ -68,8 +68,8 @@ zram_max_sigkill = 60 %
Valid values are positive floating-point numbers. Valid values are positive floating-point numbers.
rate_mem = 4 rate_mem = 6
rate_swap = 2 rate_swap = 3
rate_zram = 1 rate_zram = 1
##################################################################### #####################################################################