fix psi support
This commit is contained in:
parent
408b71b4b3
commit
d60bd4ca2b
37
nohang
37
nohang
@ -1016,6 +1016,12 @@ gui_notifications = conf_parse_bool('gui_notifications')
|
|||||||
decrease_oom_score_adj = conf_parse_bool('decrease_oom_score_adj')
|
decrease_oom_score_adj = conf_parse_bool('decrease_oom_score_adj')
|
||||||
execute_the_command = conf_parse_bool('execute_the_command')
|
execute_the_command = conf_parse_bool('execute_the_command')
|
||||||
|
|
||||||
|
|
||||||
|
ignore_psi = conf_parse_bool('ignore_psi')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
regex_matching = conf_parse_bool('regex_matching')
|
regex_matching = conf_parse_bool('regex_matching')
|
||||||
|
|
||||||
re_match_cmdline = conf_parse_bool('re_match_cmdline')
|
re_match_cmdline = conf_parse_bool('re_match_cmdline')
|
||||||
@ -1614,19 +1620,23 @@ psi_min_sleep_time_after_action = psi_avg10_sleep_time
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
|
||||||
if psi_support:
|
if psi_support and not ignore_psi:
|
||||||
# ta0 = time()
|
# ta0 = time()
|
||||||
# a0 = psi_mem_some_avg_total()
|
# a0 = psi_mem_some_avg_total()
|
||||||
kill_psi_t0 = time()
|
kill_psi_t0 = time()
|
||||||
term_psi_t0 = time()
|
term_psi_t0 = time()
|
||||||
|
|
||||||
|
|
||||||
|
avg_value = ''
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
|
if psi_support and not ignore_psi:
|
||||||
if psi_support:
|
#print(rline1(psi_path))
|
||||||
print(rline1(psi_path))
|
|
||||||
avg10 = psi_mem_some_avg10()
|
avg10 = psi_mem_some_avg10()
|
||||||
|
if print_mem_check_results:
|
||||||
|
avg_value = 'PSI mem some avg10: {} | '.format(str(avg10).rjust(6))
|
||||||
|
|
||||||
if avg10 >= sigkill_psi and time() - kill_psi_t0 >= psi_min_sleep_time_after_action:
|
if avg10 >= sigkill_psi and time() - kill_psi_t0 >= psi_min_sleep_time_after_action:
|
||||||
time0 = time()
|
time0 = time()
|
||||||
@ -1639,8 +1649,8 @@ while True:
|
|||||||
find_victim_and_send_signal(SIGTERM)
|
find_victim_and_send_signal(SIGTERM)
|
||||||
term_psi_t0 = time()
|
term_psi_t0 = time()
|
||||||
else:
|
else:
|
||||||
print('PSI is OK or psi_min_sleep_time_after_action did not pass')
|
#print('PSI is OK or psi_min_sleep_time_after_action did not pass')
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ -1701,26 +1711,29 @@ while True:
|
|||||||
|
|
||||||
# Output avialable mem sizes
|
# Output avialable mem sizes
|
||||||
if swap_total == 0 and mem_used_zram == 0:
|
if swap_total == 0 and mem_used_zram == 0:
|
||||||
print('MemAvail: {} M, {} %'.format(
|
print('{}MemAvail: {} M, {} %'.format(
|
||||||
human(mem_available, mem_len),
|
human(mem_available, mem_len),
|
||||||
just_percent_mem(mem_available / mem_total)))
|
just_percent_mem(mem_available / mem_total)),
|
||||||
|
avg_value)
|
||||||
|
|
||||||
elif swap_total > 0 and mem_used_zram == 0:
|
elif swap_total > 0 and mem_used_zram == 0:
|
||||||
print('MemAvail: {} M, {} % | SwapFree: {} M, {} %'.format(
|
print('{}MemAvail: {} M, {} % | SwapFree: {} M, {} %'.format(
|
||||||
human(mem_available, mem_len),
|
human(mem_available, mem_len),
|
||||||
just_percent_mem(mem_available / mem_total),
|
just_percent_mem(mem_available / mem_total),
|
||||||
human(swap_free, swap_len),
|
human(swap_free, swap_len),
|
||||||
just_percent_swap(swap_free / (swap_total + 0.1))))
|
just_percent_swap(swap_free / (swap_total + 0.1))),
|
||||||
|
avg_value)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print('MemAvail: {} M, {} % | SwapFree: {} M, {} % | Mem'
|
print('{}MemAvail: {} M, {} % | SwapFree: {} M, {} % | Mem'
|
||||||
'UsedZram: {} M, {} %'.format(
|
'UsedZram: {} M, {} %'.format(
|
||||||
human(mem_available, mem_len),
|
human(mem_available, mem_len),
|
||||||
just_percent_mem(mem_available / mem_total),
|
just_percent_mem(mem_available / mem_total),
|
||||||
human(swap_free, swap_len),
|
human(swap_free, swap_len),
|
||||||
just_percent_swap(swap_free / (swap_total + 0.1)),
|
just_percent_swap(swap_free / (swap_total + 0.1)),
|
||||||
human(mem_used_zram, mem_len),
|
human(mem_used_zram, mem_len),
|
||||||
just_percent_mem(mem_used_zram / mem_total)))
|
just_percent_mem(mem_used_zram / mem_total)),
|
||||||
|
avg_value)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
28
nohang.conf
28
nohang.conf
@ -45,16 +45,6 @@ $SIGTERM_PSI_AVG = 60
|
|||||||
$PSI_AVG_TIME = 3
|
$PSI_AVG_TIME = 3
|
||||||
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
|
|
||||||
sigkill_psi_avg10 = 90
|
|
||||||
sigterm_psi_avg10 = 60
|
|
||||||
psi_avg10_sleep_time = 30
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
1. Thresholds below which a signal should be sent to the victim
|
1. Thresholds below which a signal should be sent to the victim
|
||||||
@ -86,6 +76,18 @@ swap_min_sigkill = 5 %
|
|||||||
zram_max_sigterm = 50 %
|
zram_max_sigterm = 50 %
|
||||||
zram_max_sigkill = 55 %
|
zram_max_sigkill = 55 %
|
||||||
|
|
||||||
|
|
||||||
|
Response on PSI memory some avg10 value
|
||||||
|
(/proc/pressure/memory on systems with Linux 4.20+).
|
||||||
|
|
||||||
|
ignore_psi = True
|
||||||
|
|
||||||
|
sigterm_psi_avg10 = 60
|
||||||
|
sigkill_psi_avg10 = 90
|
||||||
|
|
||||||
|
psi_avg10_sleep_time = 30
|
||||||
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
2. The frequency of checking the amount of available memory
|
2. The frequency of checking the amount of available memory
|
||||||
@ -130,8 +132,8 @@ min_badness = 50
|
|||||||
|
|
||||||
Valid values are non-negative floating-point numbers.
|
Valid values are non-negative floating-point numbers.
|
||||||
|
|
||||||
min_delay_after_sigterm = 1
|
min_delay_after_sigterm = 0.2
|
||||||
min_delay_after_sigkill = 3
|
min_delay_after_sigkill = 0.8
|
||||||
|
|
||||||
Процессы браузера chromium обычно имеют oom_score_adj
|
Процессы браузера chromium обычно имеют oom_score_adj
|
||||||
200 или 300. Это приводит к тому, что процессы хрома умирают
|
200 или 300. Это приводит к тому, что процессы хрома умирают
|
||||||
@ -352,7 +354,7 @@ print_config = False
|
|||||||
Print memory check results.
|
Print memory check results.
|
||||||
Valid values are True and False.
|
Valid values are True and False.
|
||||||
|
|
||||||
print_mem_check_results = True
|
print_mem_check_results = False
|
||||||
|
|
||||||
Print sleep periods between memory checks.
|
Print sleep periods between memory checks.
|
||||||
Valid values are True and False.
|
Valid values are True and False.
|
||||||
|
Loading…
Reference in New Issue
Block a user