add psi_pat to config; fix poll rates
This commit is contained in:
parent
34b35bf7ef
commit
babbe6acfe
26
nohang
26
nohang
@ -42,8 +42,6 @@ wait_time = 10
|
|||||||
|
|
||||||
notify_helper_path = '/usr/sbin/nohang_notify_helper'
|
notify_helper_path = '/usr/sbin/nohang_notify_helper'
|
||||||
|
|
||||||
psi_path = '/proc/pressure/memory'
|
|
||||||
|
|
||||||
psi_support = os.path.exists(psi_path)
|
psi_support = os.path.exists(psi_path)
|
||||||
|
|
||||||
HR = ''
|
HR = ''
|
||||||
@ -63,6 +61,7 @@ stat_dict = dict()
|
|||||||
|
|
||||||
|
|
||||||
def print_version():
|
def print_version():
|
||||||
|
# сначала пытаться получ версию прямо из гита - вариант для неустановленых
|
||||||
try:
|
try:
|
||||||
v = rline1('/etc/nohang/version')
|
v = rline1('/etc/nohang/version')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
@ -146,7 +145,7 @@ def pid_to_starttime(pid):
|
|||||||
2].split(' ')[20]
|
2].split(' ')[20]
|
||||||
|
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
print('LOL')
|
# print('LOL')
|
||||||
with open('/proc/' + pid + '/stat', 'rb') as f:
|
with open('/proc/' + pid + '/stat', 'rb') as f:
|
||||||
starttime = f.read().decode('utf-8', 'ignore').rpartition(
|
starttime = f.read().decode('utf-8', 'ignore').rpartition(
|
||||||
')')[2].split(' ')[20]
|
')')[2].split(' ')[20]
|
||||||
@ -1655,6 +1654,19 @@ else:
|
|||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if 'psi_path' in config_dict:
|
||||||
|
psi_path = config_dict['psi_path']
|
||||||
|
else:
|
||||||
|
errprint('psi_path is not in config\nExit')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print_total_stat = conf_parse_bool('print_total_stat')
|
print_total_stat = conf_parse_bool('print_total_stat')
|
||||||
print_proc_table = conf_parse_bool('print_proc_table')
|
print_proc_table = conf_parse_bool('print_proc_table')
|
||||||
|
|
||||||
@ -1861,9 +1873,9 @@ if gui_notifications or gui_low_memory_warnings:
|
|||||||
SIGTERM: 'Terminating'}
|
SIGTERM: 'Terminating'}
|
||||||
|
|
||||||
|
|
||||||
rate_mem = rate_mem * 1048576
|
rate_mem = rate_mem * 1024
|
||||||
rate_swap = rate_swap * 1048576
|
rate_swap = rate_swap * 1024
|
||||||
rate_zram = rate_zram * 1048576
|
rate_zram = rate_zram * 1024
|
||||||
|
|
||||||
|
|
||||||
# print(rate_mem, rate_swap, rate_zram)
|
# print(rate_mem, rate_swap, rate_zram)
|
||||||
@ -1983,7 +1995,7 @@ while True:
|
|||||||
if mem_report:
|
if mem_report:
|
||||||
|
|
||||||
speed = delta / 1024.0 / report_delta
|
speed = delta / 1024.0 / report_delta
|
||||||
speed_info = ' | ΔMem: {} M/s'.format(
|
speed_info = ' | dMem: {} M/s'.format(
|
||||||
str(round(speed)).rjust(5)
|
str(round(speed)).rjust(5)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
14
nohang.conf
14
nohang.conf
@ -67,6 +67,14 @@ zram_max_sigkill = 55 %
|
|||||||
|
|
||||||
ignore_psi = True
|
ignore_psi = True
|
||||||
|
|
||||||
|
Choose path to PSI file.
|
||||||
|
|
||||||
|
psi_path = /sys/fs/cgroup/unified/user.slice/memory.pressure
|
||||||
|
psi_path = /sys/fs/cgroup/unified/system.slice/memory.pressure
|
||||||
|
psi_path = /sys/fs/cgroup/unified/system.slice/foo.service/memory.pressure
|
||||||
|
|
||||||
|
psi_path = /proc/pressure/memory
|
||||||
|
|
||||||
sigterm_psi_avg10 = 60
|
sigterm_psi_avg10 = 60
|
||||||
sigkill_psi_avg10 = 90
|
sigkill_psi_avg10 = 90
|
||||||
|
|
||||||
@ -93,9 +101,9 @@ psi_avg10_sleep_time = 60
|
|||||||
|
|
||||||
Valid values are positive floating-point numbers.
|
Valid values are positive floating-point numbers.
|
||||||
|
|
||||||
rate_mem = 3
|
rate_mem = 4000
|
||||||
rate_swap = 1.5
|
rate_swap = 1500
|
||||||
rate_zram = 0.5
|
rate_zram = 500
|
||||||
|
|
||||||
See also https://github.com/rfjakob/earlyoom/issues/61
|
See also https://github.com/rfjakob/earlyoom/issues/61
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user