enforce and describe new valid values in the config (and other changes)

- improve configs validation

- enforce and describe new valid values in configs

- remove over_sleep key from configs

- fix Bug with PSI #84
This commit is contained in:
Alexey Avramov 2020-03-23 01:33:48 +09:00
parent 3e170f5ec4
commit daca5ccf1e
4 changed files with 470 additions and 408 deletions

View File

@ -14,7 +14,14 @@ from signal import signal, SIGKILL, SIGTERM, SIGINT, SIGQUIT, SIGHUP, SIGUSR1
def missing_config_key(key): def missing_config_key(key):
""" """
""" """
errprint('ERROR: missing config key "{}"'.format(key)) errprint('ERROR: invalid config: missing key "{}"'.format(key))
exit(1)
def invalid_config_key_value(key):
"""
"""
errprint('ERROR: invalid config: invalid "{}" value'.format(key))
exit(1) exit(1)
@ -439,8 +446,6 @@ def send_notify_etc(pid, name, command):
def check_config(): def check_config():
""" """
""" """
# log('#' * 79)
log('\n1. Common zram settings') log('\n1. Common zram settings')
log(' zram_checking_enabled: {}'.format(zram_checking_enabled)) log(' zram_checking_enabled: {}'.format(zram_checking_enabled))
@ -626,47 +631,30 @@ def check_config():
log(' debug_threading: {}'.format(debug_threading)) log(' debug_threading: {}'.format(debug_threading))
log(' separate_log: {}'.format(separate_log)) log(' separate_log: {}'.format(separate_log))
log('#' * 79)
if check_config_flag: if check_config_flag:
log('config is OK') log('\nconfig is OK')
exit() exit()
def get_swap_threshold_tuple(string): def get_swap_threshold_tuple(string, key):
# re (Num %, True) or (Num KiB, False) # re (Num %, True) or (Num KiB, False)
"""Returns KiB value if abs val was set in config, or tuple with %""" """Returns KiB value if abs val was set in config, or tuple with %"""
# return tuple with abs and bool: (abs %, True) or (abs MiB, False) # return tuple with abs and bool: (abs %, True) or (abs MiB, False)
if string.endswith('%'): if string.endswith('%'):
valid = string_to_float_convert_test(string[:-1]) value = string_to_float_convert_test(string[:-1])
if valid is None: if value is None or value < 0 or value > 100:
errprint('somewhere swap unit is not float_%') invalid_config_key_value(key)
exit(1)
value = float(string[:-1].strip())
if value < 0 or value > 100:
errprint('invalid value, must be from the range[0; 100] %')
exit(1)
return value, True return value, True
elif string.endswith('M'): elif string.endswith('M'):
valid = string_to_float_convert_test(string[:-1]) value = string_to_float_convert_test(string[:-1])
if valid is None: if value is None or value < 0:
errprint('somewhere swap unit is not float_M') invalid_config_key_value(key)
exit(1)
value = float(string[:-1].strip()) * 1024
if value < 0:
errprint('invalid unit in config (negative value)')
exit(1)
return value, False return value, False
else: else:
errprint( invalid_config_key_value(key)
'Invalid config file. There are invalid units somewhere\nExit')
exit(1)
def find_cgroup_indexes(): def find_cgroup_indexes():
@ -1439,7 +1427,7 @@ def conf_parse_bool(param):
""" """
Get bool parameters from the config_dict. Get bool parameters from the config_dict.
param: config_dicst key param: config_dict key
returns bool returns bool
""" """
if param in config_dict: if param in config_dict:
@ -1449,10 +1437,7 @@ def conf_parse_bool(param):
elif param_str == 'False': elif param_str == 'False':
return False return False
else: else:
errprint('Invalid value of the "{}" parameter.'.format(param)) invalid_config_key_value(param)
errprint('Valid values are True and False.')
errprint('Exit')
exit(1)
else: else:
missing_config_key(param) missing_config_key(param)
@ -2014,7 +1999,23 @@ def check_zram_ex():
""" """
mem_used_zram = check_zram() mem_used_zram = check_zram()
if mem_used_zram >= hard_threshold_max_zram_kb: 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
if (mem_used_zram >= hard_threshold_max_zram_kb and
ma_hard_threshold_exceded):
mem_info = 'Memory status that requires corrective actions:\n Mem' \ mem_info = 'Memory status that requires corrective actions:\n Mem' \
'UsedZram [{} MiB, {} %] >= hard_threshold_max_zram [{} MiB' \ 'UsedZram [{} MiB, {} %] >= hard_threshold_max_zram [{} MiB' \
@ -2027,7 +2028,8 @@ def check_zram_ex():
return SIGKILL, mem_info, mem_used_zram return SIGKILL, mem_info, mem_used_zram
if mem_used_zram >= soft_threshold_max_zram_kb: if (mem_used_zram >= soft_threshold_max_zram_kb and
ma_soft_threshold_exceded):
mem_info = 'Memory status that requires corrective actions:\n ' \ mem_info = 'Memory status that requires corrective actions:\n ' \
'MemUsedZram [{} MiB, {} %] >= soft_threshold_max_zram [{}' \ 'MemUsedZram [{} MiB, {} %] >= soft_threshold_max_zram [{}' \
@ -2040,7 +2042,8 @@ def check_zram_ex():
return SIGTERM, mem_info, mem_used_zram return SIGTERM, mem_info, mem_used_zram
if low_memory_warnings_enabled: if low_memory_warnings_enabled:
if mem_used_zram >= warning_threshold_max_zram_kb: if (mem_used_zram >= warning_threshold_max_zram_kb and
ma_warning_threshold_exceded):
return 'WARN', None, mem_used_zram return 'WARN', None, mem_used_zram
return None, None, mem_used_zram return None, None, mem_used_zram
@ -2103,10 +2106,11 @@ def check_psi_ex(psi_t0, psi_kill_exceeded_timer, psi_term_exceeded_timer, x0,
ma_hard_threshold_exceded, ma_soft_threshold_exceded, ma_hard_threshold_exceded, ma_soft_threshold_exceded,
ma_warning_threshold_exceded)) ma_warning_threshold_exceded))
if (psi_kill_exceeded_timer >= psi_excess_duration and if (sigkill_psi_exceeded and psi_kill_exceeded_timer >=
psi_post_action_delay_exceeded and ma_hard_threshold_exceded): psi_excess_duration and 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' \
' = {} sec) for {} seconds'.format( ' = {} sec) for {} seconds'.format(
psi_avg_value, psi_avg_value,
@ -2134,10 +2138,11 @@ 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 (sigterm_psi_exceeded and psi_term_exceeded_timer >=
psi_post_action_delay_exceeded and ma_soft_threshold_exceded): psi_excess_duration and 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' \
' = {} sec) for {} seconds'.format( ' = {} sec) for {} seconds'.format(
psi_avg_value, psi_avg_value,
@ -2614,11 +2619,9 @@ def calculate_percent(arg_key):
parse conf dict parse conf dict
Calculate mem_min_KEY_percent. Calculate mem_min_KEY_percent.
Try use this one)
arg_key: str key for config_dict arg_key: str key for config_dict
returns int mem_min_percent or NoneType if got some error returns int mem_min_percent or NoneType if got some error
""" """
if arg_key in config_dict: if arg_key in config_dict:
mem_min = config_dict[arg_key] mem_min = config_dict[arg_key]
@ -2628,15 +2631,7 @@ def calculate_percent(arg_key):
# then 'float test' # then 'float test'
mem_min_percent = string_to_float_convert_test(mem_min_percent) mem_min_percent = string_to_float_convert_test(mem_min_percent)
if mem_min_percent is None: if mem_min_percent is None:
errprint('Invalid {} value, not float\nExit'.format(arg_key)) invalid_config_key_value(arg_key)
exit(1)
# Final validations...
if mem_min_percent < 0 or mem_min_percent > 100:
errprint(
'{}, as percents value, out of ran'
'ge [0; 100]\nExit'.format(arg_key))
exit(1)
# soft_threshold_min_mem_percent is clean and valid float # soft_threshold_min_mem_percent is clean and valid float
# percentage. Can translate into Kb # percentage. Can translate into Kb
mem_min_kb = mem_min_percent / 100 * mem_total mem_min_kb = mem_min_percent / 100 * mem_total
@ -2645,27 +2640,28 @@ def calculate_percent(arg_key):
elif mem_min.endswith('M'): elif mem_min.endswith('M'):
mem_min_mb = string_to_float_convert_test(mem_min[:-1].strip()) mem_min_mb = string_to_float_convert_test(mem_min[:-1].strip())
if mem_min_mb is None: if mem_min_mb is None:
errprint('Invalid {} value, not float\nExit'.format(arg_key)) invalid_config_key_value(arg_key)
exit(1)
mem_min_kb = mem_min_mb * 1024 mem_min_kb = mem_min_mb * 1024
if mem_min_kb > mem_total:
errprint(
'{} value can not be greater then MemT'
'otal ({} MiB)\nExit'.format(
arg_key, round(
mem_total / 1024)))
exit(1)
mem_min_percent = mem_min_kb / mem_total * 100 mem_min_percent = mem_min_kb / mem_total * 100
else: else:
log('Invalid {} units in config.\n Exit'.format(arg_key)) invalid_config_key_value(arg_key)
exit(1)
mem_min_percent = None
else: else:
log('{} not in config\nExit'.format(arg_key)) missing_config_key(arg_key)
exit(1)
mem_min_percent = None if (arg_key == 'soft_threshold_min_mem' or
arg_key == 'hard_threshold_min_mem'):
if mem_min_kb > mem_total * 0.5 or mem_min_kb < 0:
invalid_config_key_value(arg_key)
if (arg_key == 'soft_threshold_max_zram' or
arg_key == 'hard_threshold_max_zram'):
if mem_min_kb > mem_total * 0.9 or mem_min_kb < mem_total * 0.1:
invalid_config_key_value(arg_key)
if (arg_key == 'warning_threshold_min_mem' or
arg_key == 'warning_threshold_max_zram'):
if mem_min_kb > mem_total or mem_min_kb < 0:
invalid_config_key_value(arg_key)
return mem_min_kb, mem_min_mb, mem_min_percent return mem_min_kb, mem_min_mb, mem_min_percent
@ -3094,26 +3090,18 @@ print_victim_cmdline = conf_parse_bool('print_victim_cmdline')
print_config_at_startup = conf_parse_bool('print_config_at_startup') print_config_at_startup = conf_parse_bool('print_config_at_startup')
print_mem_check_results = conf_parse_bool('print_mem_check_results') print_mem_check_results = conf_parse_bool('print_mem_check_results')
debug_sleep = conf_parse_bool('debug_sleep') debug_sleep = conf_parse_bool('debug_sleep')
hide_corrective_action_type = conf_parse_bool('hide_corrective_action_type') hide_corrective_action_type = conf_parse_bool('hide_corrective_action_type')
low_memory_warnings_enabled = conf_parse_bool('low_memory_warnings_enabled') low_memory_warnings_enabled = conf_parse_bool('low_memory_warnings_enabled')
post_action_gui_notifications = conf_parse_bool( post_action_gui_notifications = conf_parse_bool(
'post_action_gui_notifications') 'post_action_gui_notifications')
debug_threading = conf_parse_bool('debug_threading') debug_threading = conf_parse_bool('debug_threading')
psi_checking_enabled = conf_parse_bool('psi_checking_enabled') psi_checking_enabled = conf_parse_bool('psi_checking_enabled')
ignore_psi = not psi_checking_enabled ignore_psi = not psi_checking_enabled
if psi_checking_enabled: if psi_checking_enabled:
try: try:
@ -3127,12 +3115,10 @@ if psi_checking_enabled:
zram_checking_enabled = conf_parse_bool('zram_checking_enabled') zram_checking_enabled = conf_parse_bool('zram_checking_enabled')
ignore_zram = not zram_checking_enabled ignore_zram = not zram_checking_enabled
debug_gui_notifications = conf_parse_bool('debug_gui_notifications') debug_gui_notifications = conf_parse_bool('debug_gui_notifications')
ignore_positive_oom_score_adj = conf_parse_bool( ignore_positive_oom_score_adj = conf_parse_bool(
'ignore_positive_oom_score_adj') 'ignore_positive_oom_score_adj')
(soft_threshold_min_mem_kb, soft_threshold_min_mem_mb, (soft_threshold_min_mem_kb, soft_threshold_min_mem_mb,
soft_threshold_min_mem_percent) = calculate_percent('soft_threshold_min_mem') soft_threshold_min_mem_percent) = calculate_percent('soft_threshold_min_mem')
@ -3155,29 +3141,19 @@ ignore_positive_oom_score_adj = conf_parse_bool(
warning_threshold_max_zram_percent) = calculate_percent( warning_threshold_max_zram_percent) = calculate_percent(
'warning_threshold_max_zram') 'warning_threshold_max_zram')
if 'post_zombie_delay' in config_dict: if 'post_zombie_delay' in config_dict:
post_zombie_delay = string_to_float_convert_test( post_zombie_delay = string_to_float_convert_test(
config_dict['post_zombie_delay']) config_dict['post_zombie_delay'])
if post_zombie_delay is None: if post_zombie_delay is None or post_zombie_delay < 0:
errprint('Invalid post_zombie_delay, not float\nExit') invalid_config_key_value('post_zombie_delay')
exit(1)
if post_zombie_delay < 0:
errprint('post_zombie_delay MUST be >= 0\nExit')
exit(1)
else: else:
missing_config_key('post_zombie_delay') missing_config_key('post_zombie_delay')
if 'victim_cache_time' in config_dict: if 'victim_cache_time' in config_dict:
victim_cache_time = string_to_float_convert_test( victim_cache_time = string_to_float_convert_test(
config_dict['victim_cache_time']) config_dict['victim_cache_time'])
if victim_cache_time is None: if victim_cache_time is None or victim_cache_time < 0:
errprint('Invalid victim_cache_time, not float\nExit') invalid_config_key_value('victim_cache_time')
exit(1)
if victim_cache_time < 0:
errprint('victim_cache_time MUST be >= 0\nExit')
exit(1)
else: else:
missing_config_key('victim_cache_time') missing_config_key('victim_cache_time')
@ -3185,37 +3161,24 @@ else:
if 'env_cache_time' in config_dict: if 'env_cache_time' in config_dict:
env_cache_time = string_to_float_convert_test( env_cache_time = string_to_float_convert_test(
config_dict['env_cache_time']) config_dict['env_cache_time'])
if env_cache_time is None: if env_cache_time is None or env_cache_time < 0:
errprint('Invalid env_cache_time value, not float\nExit') invalid_config_key_value('env_cache_time')
exit(1)
if env_cache_time < 0:
errprint('env_cache_time MUST be >= 0\nExit')
exit(1)
else: else:
missing_config_key('env_cache_time') missing_config_key('env_cache_time')
if 'exe_timeout' in config_dict: if 'exe_timeout' in config_dict:
exe_timeout = string_to_float_convert_test( exe_timeout = string_to_float_convert_test(config_dict['exe_timeout'])
config_dict['exe_timeout']) if exe_timeout is None or exe_timeout < 0.1:
if exe_timeout is None: invalid_config_key_value('exe_timeout')
errprint('Invalid exe_timeout value, not float\nExit')
exit(1)
if exe_timeout <= 0:
errprint('exe_timeout MUST be > 0\nExit')
exit(1)
else: else:
missing_config_key('exe_timeout') missing_config_key('exe_timeout')
if 'fill_rate_mem' in config_dict: if 'fill_rate_mem' in config_dict:
fill_rate_mem = string_to_float_convert_test(config_dict['fill_rate_mem']) fill_rate_mem = string_to_float_convert_test(config_dict['fill_rate_mem'])
if fill_rate_mem is None: if fill_rate_mem is None or fill_rate_mem < 100:
errprint('Invalid fill_rate_mem value, not float\nExit') invalid_config_key_value('fill_rate_mem')
exit(1)
if fill_rate_mem <= 0:
errprint('fill_rate_mem MUST be > 0\nExit')
exit(1)
else: else:
missing_config_key('fill_rate_mem') missing_config_key('fill_rate_mem')
@ -3223,12 +3186,8 @@ else:
if 'fill_rate_swap' in config_dict: if 'fill_rate_swap' in config_dict:
fill_rate_swap = string_to_float_convert_test( fill_rate_swap = string_to_float_convert_test(
config_dict['fill_rate_swap']) config_dict['fill_rate_swap'])
if fill_rate_swap is None: if fill_rate_swap is None or fill_rate_swap < 100:
errprint('Invalid fill_rate_swap value, not float\nExit') invalid_config_key_value('fill_rate_swap')
exit(1)
if fill_rate_swap <= 0:
errprint('fill_rate_swap MUST be > 0\nExit')
exit(1)
else: else:
missing_config_key('fill_rate_swap') missing_config_key('fill_rate_swap')
@ -3236,12 +3195,8 @@ else:
if 'fill_rate_zram' in config_dict: if 'fill_rate_zram' in config_dict:
fill_rate_zram = string_to_float_convert_test( fill_rate_zram = string_to_float_convert_test(
config_dict['fill_rate_zram']) config_dict['fill_rate_zram'])
if fill_rate_zram is None: if fill_rate_zram is None or fill_rate_zram < 100:
errprint('Invalid fill_rate_zram value, not float\nExit') invalid_config_key_value('fill_rate_zram')
exit(1)
if fill_rate_zram <= 0:
errprint('fill_rate_zram MUST be > 0\nExit')
exit(1)
else: else:
missing_config_key('fill_rate_zram') missing_config_key('fill_rate_zram')
@ -3262,12 +3217,8 @@ else:
if 'post_soft_action_delay' in config_dict: if 'post_soft_action_delay' in config_dict:
post_soft_action_delay = string_to_float_convert_test( post_soft_action_delay = string_to_float_convert_test(
config_dict['post_soft_action_delay']) config_dict['post_soft_action_delay'])
if post_soft_action_delay is None: if post_soft_action_delay is None or post_soft_action_delay < 0.1:
errprint('Invalid post_soft_action_delay value, not float\nExit') invalid_config_key_value('post_soft_action_delay')
exit(1)
if post_soft_action_delay < 0:
errprint('post_soft_action_delay must be positiv\nExit')
exit(1)
else: else:
missing_config_key('post_soft_action_delay') missing_config_key('post_soft_action_delay')
@ -3275,12 +3226,8 @@ else:
if 'psi_post_action_delay' in config_dict: if 'psi_post_action_delay' in config_dict:
psi_post_action_delay = string_to_float_convert_test( psi_post_action_delay = string_to_float_convert_test(
config_dict['psi_post_action_delay']) config_dict['psi_post_action_delay'])
if psi_post_action_delay is None: if psi_post_action_delay is None or psi_post_action_delay < 10:
errprint('Invalid psi_post_action_delay value, not float\nExit') invalid_config_key_value('psi_post_action_delay')
exit(1)
if psi_post_action_delay < 0:
errprint('psi_post_action_delay must be positive\nExit')
exit(1)
else: else:
missing_config_key('psi_post_action_delay') missing_config_key('psi_post_action_delay')
@ -3288,12 +3235,9 @@ else:
if 'hard_threshold_max_psi' in config_dict: if 'hard_threshold_max_psi' in config_dict:
hard_threshold_max_psi = string_to_float_convert_test( hard_threshold_max_psi = string_to_float_convert_test(
config_dict['hard_threshold_max_psi']) config_dict['hard_threshold_max_psi'])
if hard_threshold_max_psi is None: if (hard_threshold_max_psi is None or hard_threshold_max_psi < 1 or
errprint('Invalid hard_threshold_max_psi value, not float\nExit') hard_threshold_max_psi > 100):
exit(1) invalid_config_key_value('hard_threshold_max_psi')
if hard_threshold_max_psi < 0 or hard_threshold_max_psi > 100:
errprint('hard_threshold_max_psi must be in the range [0; 100]\nExit')
exit(1)
else: else:
missing_config_key('hard_threshold_max_psi') missing_config_key('hard_threshold_max_psi')
@ -3301,12 +3245,9 @@ else:
if 'soft_threshold_max_psi' in config_dict: if 'soft_threshold_max_psi' in config_dict:
soft_threshold_max_psi = string_to_float_convert_test( soft_threshold_max_psi = string_to_float_convert_test(
config_dict['soft_threshold_max_psi']) config_dict['soft_threshold_max_psi'])
if soft_threshold_max_psi is None: if (soft_threshold_max_psi is None or soft_threshold_max_psi < 1 or
errprint('Invalid soft_threshold_max_psi value, not float\nExit') soft_threshold_max_psi > 100):
exit(1) invalid_config_key_value('soft_threshold_max_psi')
if soft_threshold_max_psi < 0 or soft_threshold_max_psi > 100:
errprint('soft_threshold_max_psi must be in the range [0; 100]\nExit')
exit(1)
else: else:
missing_config_key('soft_threshold_max_psi') missing_config_key('soft_threshold_max_psi')
@ -3314,26 +3255,17 @@ else:
if 'warning_threshold_max_psi' in config_dict: if 'warning_threshold_max_psi' in config_dict:
warning_threshold_max_psi = string_to_float_convert_test( warning_threshold_max_psi = string_to_float_convert_test(
config_dict['warning_threshold_max_psi']) config_dict['warning_threshold_max_psi'])
if warning_threshold_max_psi is None: if (warning_threshold_max_psi is None or warning_threshold_max_psi < 1 or
errprint('Invalid warning_threshold_max_psi value, not float\nExit') warning_threshold_max_psi > 100):
exit(1) invalid_config_key_value('warning_threshold_max_psi')
if warning_threshold_max_psi < 0 or warning_threshold_max_psi > 100:
errprint(
'warning_threshold_max_psi must be in the range [0; 100]\nExit')
exit(1)
else: else:
missing_config_key('warning_threshold_max_psi') missing_config_key('warning_threshold_max_psi')
if 'min_badness' in config_dict: if 'min_badness' in config_dict:
min_badness = string_to_int_convert_test( min_badness = string_to_int_convert_test(config_dict['min_badness'])
config_dict['min_badness']) if min_badness is None or min_badness < 1:
if min_badness is None: invalid_config_key_value('min_badness')
errprint('Invalid min_badness value, not integer\nExit')
exit(1)
if min_badness < 0 or min_badness > 1000:
errprint('Invalud min_badness value\nExit')
exit(1)
else: else:
missing_config_key('min_badness') missing_config_key('min_badness')
@ -3341,12 +3273,8 @@ else:
if 'min_post_warning_delay' in config_dict: if 'min_post_warning_delay' in config_dict:
min_post_warning_delay = string_to_float_convert_test( min_post_warning_delay = string_to_float_convert_test(
config_dict['min_post_warning_delay']) config_dict['min_post_warning_delay'])
if min_post_warning_delay is None: if min_post_warning_delay is None or min_post_warning_delay < 1:
errprint('Invalid min_post_warning_delay value, not float\nExit') invalid_config_key_value('min_post_warning_delay')
exit(1)
if min_post_warning_delay < 1 or min_post_warning_delay > 300:
errprint('min_post_warning_delay value out of range [1; 300]\nExit')
exit(1)
else: else:
missing_config_key('min_post_warning_delay') missing_config_key('min_post_warning_delay')
@ -3373,14 +3301,8 @@ else:
if 'max_soft_exit_time' in config_dict: if 'max_soft_exit_time' in config_dict:
max_soft_exit_time = string_to_float_convert_test( max_soft_exit_time = string_to_float_convert_test(
config_dict['max_soft_exit_time']) config_dict['max_soft_exit_time'])
if max_soft_exit_time is None: if max_soft_exit_time is None or max_soft_exit_time < 0.1:
errprint('Invalid max_soft_exit_time val' invalid_config_key_value('max_soft_exit_time')
'ue, not float\nExit')
exit(1)
if max_soft_exit_time < 0:
errprint('max_soft_exit_time must be non-n'
'egative number\nExit')
exit(1)
else: else:
missing_config_key('max_soft_exit_time') missing_config_key('max_soft_exit_time')
@ -3397,19 +3319,19 @@ if 'psi_path' in config_dict:
try: try:
psi_file_mem_to_metrics(psi_path) psi_file_mem_to_metrics(psi_path)
except Exception as e: except Exception as e:
# log()? errprint('WARNING: invalid psi_path "{}": {}'.format(
print('WARNING: invalid psi_path "{}": {}'.format(
psi_path, e)) psi_path, e))
ignore_psi = True
else: else:
errprint('psi_path is not in config\nExit') missing_config_key('psi_path')
exit(1)
if 'psi_metrics' in config_dict: if 'psi_metrics' in config_dict:
psi_metrics = config_dict['psi_metrics'] psi_metrics = config_dict['psi_metrics']
valid_metrics = {
'some_avg10', 'some_avg60', 'some_avg300',
'full_avg10', 'full_avg60', 'full_avg300'}
if psi_metrics not in valid_metrics:
invalid_config_key_value('psi_metrics')
else: else:
missing_config_key('psi_metrics') missing_config_key('psi_metrics')
@ -3426,15 +3348,10 @@ else:
if 'extra_table_info' in config_dict: if 'extra_table_info' in config_dict:
extra_table_info = config_dict['extra_table_info'] extra_table_info = config_dict['extra_table_info']
if (extra_table_info != 'None' and valid_eti = {'None', 'cwd', 'realpath',
extra_table_info != 'cgroup_v1' and 'cgroup_v1', 'cgroup_v2', 'cmdline', 'environ'}
extra_table_info != 'cgroup_v2' and if extra_table_info not in valid_eti:
extra_table_info != 'cmdline' and invalid_config_key_value('extra_table_info')
extra_table_info != 'environ' and
extra_table_info != 'realpath' and extra_table_info != 'cwd'):
errprint('Invalid config: invalid extra_table_info value\nExit')
exit(1)
else: else:
missing_config_key('extra_table_info') missing_config_key('extra_table_info')
@ -3476,12 +3393,8 @@ if separate_log:
if 'min_mem_report_interval' in config_dict: if 'min_mem_report_interval' in config_dict:
min_mem_report_interval = string_to_float_convert_test( min_mem_report_interval = string_to_float_convert_test(
config_dict['min_mem_report_interval']) config_dict['min_mem_report_interval'])
if min_mem_report_interval is None: if min_mem_report_interval is None or min_mem_report_interval < 0:
errprint('Invalid min_mem_report_interval value, not float\nExit') invalid_config_key_value('min_mem_report_interval')
exit(1)
if min_mem_report_interval < 0:
errprint('min_mem_report_interval must be non-negative number\nExit')
exit(1)
else: else:
missing_config_key('min_mem_report_interval') missing_config_key('min_mem_report_interval')
@ -3489,12 +3402,8 @@ else:
if 'psi_excess_duration' in config_dict: if 'psi_excess_duration' in config_dict:
psi_excess_duration = string_to_float_convert_test( psi_excess_duration = string_to_float_convert_test(
config_dict['psi_excess_duration']) config_dict['psi_excess_duration'])
if psi_excess_duration is None: if psi_excess_duration is None or psi_excess_duration < 0:
errprint('Invalid psi_excess_duration value, not float\nExit') invalid_config_key_value('psi_excess_duration')
exit(1)
if psi_excess_duration < 0:
errprint('psi_excess_duration must be non-negative number\nExit')
exit(1)
else: else:
missing_config_key('psi_excess_duration') missing_config_key('psi_excess_duration')
@ -3502,12 +3411,8 @@ else:
if 'max_sleep' in config_dict: if 'max_sleep' in config_dict:
max_sleep = string_to_float_convert_test( max_sleep = string_to_float_convert_test(
config_dict['max_sleep']) config_dict['max_sleep'])
if max_sleep is None: if max_sleep is None or max_sleep < 0.01:
errprint('Invalid max_sleep value, not float\nExit') invalid_config_key_value('max_sleep')
exit(1)
if max_sleep <= 0:
errprint('max_sleep must be positive number\nExit')
exit(1)
else: else:
missing_config_key('max_sleep') missing_config_key('max_sleep')
@ -3515,40 +3420,14 @@ else:
if 'min_sleep' in config_dict: if 'min_sleep' in config_dict:
min_sleep = string_to_float_convert_test( min_sleep = string_to_float_convert_test(
config_dict['min_sleep']) config_dict['min_sleep'])
if min_sleep is None: if min_sleep is None or min_sleep < 0.01 or min_sleep > max_sleep:
errprint('Invalid min_sleep value, not float\nExit') invalid_config_key_value('min_sleep')
exit(1)
if min_sleep <= 0:
errprint('min_sleep must be positive number\nExit')
exit(1)
else: else:
missing_config_key('min_sleep') missing_config_key('min_sleep')
if 'over_sleep' in config_dict: over_sleep = min_sleep
over_sleep = string_to_float_convert_test( sensitivity_test_time = over_sleep / 4
config_dict['over_sleep'])
if over_sleep is None:
errprint('Invalid over_sleep value, not float\nExit')
exit(1)
if over_sleep <= 0:
errprint('over_sleep must be positive number\nExit')
exit(1)
else:
missing_config_key('over_sleep')
sensitivity_test_time = over_sleep / 2
if max_sleep < min_sleep:
errprint('min_sleep value must not exceed max_sleep value.\nExit')
exit(1)
if min_sleep < over_sleep:
errprint('over_sleep value must not exceed min_sleep value.\nExit')
exit(1)
if max_sleep == min_sleep: if max_sleep == min_sleep:
@ -3579,11 +3458,11 @@ psi_support = os.path.exists(psi_path)
# Get KiB levels if it's possible. # Get KiB levels if it's possible.
soft_threshold_min_swap_tuple = get_swap_threshold_tuple( soft_threshold_min_swap_tuple = get_swap_threshold_tuple(
soft_threshold_min_swap) soft_threshold_min_swap, 'soft_threshold_min_swap')
hard_threshold_min_swap_tuple = get_swap_threshold_tuple( hard_threshold_min_swap_tuple = get_swap_threshold_tuple(
hard_threshold_min_swap) hard_threshold_min_swap, 'hard_threshold_min_swap')
warning_threshold_min_swap_tuple = get_swap_threshold_tuple( warning_threshold_min_swap_tuple = get_swap_threshold_tuple(
warning_threshold_min_swap) warning_threshold_min_swap, 'warning_threshold_min_swap')
swap_kb_dict = dict() swap_kb_dict = dict()
@ -3719,6 +3598,7 @@ while True:
if CHECK_PSI: if CHECK_PSI:
psi_avg_value = find_psi_metrics_value(psi_path, psi_metrics) psi_avg_value = find_psi_metrics_value(psi_path, psi_metrics)
# print(psi_avg_value)
if monotonic() - psi_t0 >= psi_post_action_delay: if monotonic() - psi_t0 >= psi_post_action_delay:
psi_post_action_delay_exceeded = True psi_post_action_delay_exceeded = True
else: else:

View File

@ -29,7 +29,7 @@
Key: zram_checking_enabled Key: zram_checking_enabled
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False Default value: False
zram_checking_enabled = False zram_checking_enabled = False
@ -38,33 +38,44 @@ zram_checking_enabled = False
2. Common PSI settings 2. Common PSI settings
Key: psi_checking_enabled
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: True
psi_checking_enabled = True psi_checking_enabled = True
Key: psi_path
Description: Description:
Type: string Type: string
Valid values: Valid values: any string
Default value: /proc/pressure/memory
psi_path = /proc/pressure/memory psi_path = /proc/pressure/memory
Key: psi_metrics
Description: Description:
Type: string Type: string
Valid values: Valid values: some_avg10, some_avg60, some_avg300,
full_avg10, full_avg60, full_avg300
Default value: full_avg10
psi_metrics = full_avg10 psi_metrics = full_avg10
Key: psi_excess_duration
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 30
psi_excess_duration = 30 psi_excess_duration = 30
Key: psi_post_action_delay
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 10
Default value: 20
psi_post_action_delay = 20 psi_post_action_delay = 20
@ -72,159 +83,204 @@ psi_post_action_delay = 20
3. Poll rate 3. Poll rate
Key: fill_rate_mem
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 100
Default value: 4000
fill_rate_mem = 4000 fill_rate_mem = 4000
Key: fill_rate_swap
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 100
Default value: 1500
fill_rate_swap = 1500 fill_rate_swap = 1500
Key: fill_rate_zram
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 100
Default value: 4000
fill_rate_zram = 4000 fill_rate_zram = 4000
Key: max_sleep
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.01 and >= min_sleep
Default value: 3
max_sleep = 3 max_sleep = 3
Key: min_sleep
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.01 and <= max_sleep
Default value: 0.1
min_sleep = 0.1 min_sleep = 0.1
Description:
Type: float
Valid values:
over_sleep = 0.05
############################################################################### ###############################################################################
4. Warnings and notifications 4. Warnings and notifications
4.1. GUI notifications after corrective actions 4.1. GUI notifications after corrective actions
Key: post_action_gui_notifications
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: True
post_action_gui_notifications = True post_action_gui_notifications = True
Key: hide_corrective_action_type
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
hide_corrective_action_type = False hide_corrective_action_type = False
4.2. Low memory warnings 4.2. Low memory warnings
Key: low_memory_warnings_enabled
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: True
low_memory_warnings_enabled = True low_memory_warnings_enabled = True
Key: warning_exe
Description: Description:
Type: string Type: string
Valid values: Valid values: any string
Default value: (empty string)
warning_exe = warning_exe =
Key: warning_threshold_min_mem
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [0; 100] %
Default value: 20 %
warning_threshold_min_mem = 20 % warning_threshold_min_mem = 20 %
Key: warning_threshold_min_swap
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: [0; 100] % or >= 0 M
Default value: 20 %
warning_threshold_min_swap = 25 % warning_threshold_min_swap = 25 %
Key: warning_threshold_max_zram
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [0; 100] %
Default value: 45 %
warning_threshold_max_zram = 45 % warning_threshold_max_zram = 45 %
Key: warning_threshold_max_psi
Description: Description:
Type: float Type: float
Valid values: Valid values: from the range [0; 100]
Default value: 10
warning_threshold_max_psi = 10 warning_threshold_max_psi = 10
Key: min_post_warning_delay
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 1
Default value: 60
min_post_warning_delay = 60 min_post_warning_delay = 60
Key: env_cache_time
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 300
env_cache_time = 300 env_cache_time = 300
############################################################################### ###############################################################################
5. Soft threshold 5. Soft threshold (thresholds for sending the SIGTERM signal or
implementing other soft corrective action)
Key: soft_threshold_min_mem
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [0; 50] %
Default value: 5 %
soft_threshold_min_mem = 5 % soft_threshold_min_mem = 5 %
Key: soft_threshold_min_swap
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: [0; 100] % or >= 0 M
Default value: 350 M
soft_threshold_min_swap = 350 M soft_threshold_min_swap = 350 M
Key: soft_threshold_max_zram
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [10; 90] %
Default value: 55 %
soft_threshold_max_zram = 55 % soft_threshold_max_zram = 55 %
Key: soft_threshold_max_psi
Description: Description:
Type: float Type: float
Valid values: Valid values: from the range [5; 100]
Default value: 40
soft_threshold_max_psi = 40 soft_threshold_max_psi = 40
############################################################################### ###############################################################################
6. Hard threshold 6. Hard threshold (thresholds for sending the SIGKILL signal)
Key: hard_threshold_min_mem
Description:
Type: float (with % or M)
Valid values: from the range [0; 50] %
Default value: 2 %
hard_threshold_min_mem = 2 % hard_threshold_min_mem = 2 %
Key: hard_threshold_min_swap
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: [0; 100] % or >= 0 M
Default value: 150 M
hard_threshold_min_swap = 150 M hard_threshold_min_swap = 150 M
Key: hard_threshold_max_zram
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [10; 90] %
Default value: 60 %
hard_threshold_max_zram = 65 % hard_threshold_max_zram = 60 %
Key: hard_threshold_max_psi
Description: Description:
Type: float Type: float
Valid values: Valid values: from the range [5; 100]
Default value: 90
hard_threshold_max_psi = 90 hard_threshold_max_psi = 90
@ -234,9 +290,11 @@ hard_threshold_max_psi = 90
7.1. Ignore positive oom_score_adj 7.1. Ignore positive oom_score_adj
Key: ignore_positive_oom_score_adj
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
ignore_positive_oom_score_adj = False ignore_positive_oom_score_adj = False
@ -378,45 +436,59 @@ ignore_positive_oom_score_adj = False
9. Misc settings 9. Misc settings
Key: max_soft_exit_time
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.1
Default value: 10
max_soft_exit_time = 10 max_soft_exit_time = 10
Key: post_kill_exe
Description: Description:
Type: string Type: string
Valid values: Valid values: any string
Default value: (empty string)
post_kill_exe = post_kill_exe =
Key: min_badness
Description: Description:
Type: integer Type: integer
Valid values: Valid values: >= 1
Default value: 1
min_badness = 1 min_badness = 1
Key: post_soft_action_delay
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.1
Default value: 3
post_soft_action_delay = 3 post_soft_action_delay = 3
Key: post_zombie_delay
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 0.1
post_zombie_delay = 0.1 post_zombie_delay = 0.1
Key: victim_cache_time
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 10
victim_cache_time = 10 victim_cache_time = 10
Key: exe_timeout
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.1
Default value: 20
exe_timeout = 20 exe_timeout = 20
@ -424,96 +496,118 @@ exe_timeout = 20
10. Verbosity, debug, logging 10. Verbosity, debug, logging
Key: print_config_at_startup
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
print_config_at_startup = False print_config_at_startup = False
Key: print_mem_check_results
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
print_mem_check_results = False print_mem_check_results = False
Key: min_mem_report_interval
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 60
min_mem_report_interval = 60 min_mem_report_interval = 60
Key: print_proc_table
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
print_proc_table = False print_proc_table = False
Key: extra_table_info
Description: Description:
WARNING: using "cmdline" or "environ" keys can greatly slow down WARNING: using "cmdline" or "environ" keys can greatly slow down
the search for a victim in conditions of heavily swapping. the search for a victim in conditions of heavy swapping.
Type: string Type: string
Valid values: Valid values: None, cgroup_v1, cgroup_v2, realpath,
None cwd, cmdline, environ
cgroup_v1 Default value: None
cgroup_v2
realpath
cwd
cmdline
environ
extra_table_info = None extra_table_info = None
Key: print_victim_status
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: True
print_victim_status = True print_victim_status = True
Key: print_victim_cmdline
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
print_victim_cmdline = False print_victim_cmdline = False
Key: max_victim_ancestry_depth
Description: Description:
Type: integer Type: integer
Valid values: Valid values: >= 1
Default value: 3
max_victim_ancestry_depth = 3 max_victim_ancestry_depth = 3
Key: print_statistics
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: True
print_statistics = True print_statistics = True
Key: debug_psi
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
debug_psi = False debug_psi = False
Key: debug_gui_notifications
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
debug_gui_notifications = False debug_gui_notifications = False
Key: debug_sleep
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
debug_sleep = False debug_sleep = False
Key: debug_threading
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
debug_threading = False debug_threading = False
Key: separate_log
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
separate_log = False separate_log = False

View File

@ -29,7 +29,7 @@
Key: zram_checking_enabled Key: zram_checking_enabled
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False Default value: False
zram_checking_enabled = False zram_checking_enabled = False
@ -38,33 +38,44 @@ zram_checking_enabled = False
2. Common PSI settings 2. Common PSI settings
Key: psi_checking_enabled
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
psi_checking_enabled = False psi_checking_enabled = False
Key: psi_path
Description: Description:
Type: string Type: string
Valid values: Valid values: any string
Default value: /proc/pressure/memory
psi_path = /proc/pressure/memory psi_path = /proc/pressure/memory
Key: psi_metrics
Description: Description:
Type: string Type: string
Valid values: Valid values: some_avg10, some_avg60, some_avg300,
full_avg10, full_avg60, full_avg300
Default value: full_avg10
psi_metrics = full_avg10 psi_metrics = full_avg10
Key: psi_excess_duration
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 30
psi_excess_duration = 30 psi_excess_duration = 30
Key: psi_post_action_delay
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 10
Default value: 20
psi_post_action_delay = 20 psi_post_action_delay = 20
@ -72,159 +83,204 @@ psi_post_action_delay = 20
3. Poll rate 3. Poll rate
Key: fill_rate_mem
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 100
Default value: 4000
fill_rate_mem = 4000 fill_rate_mem = 4000
Key: fill_rate_swap
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 100
Default value: 1500
fill_rate_swap = 1500 fill_rate_swap = 1500
Key: fill_rate_zram
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 100
Default value: 4000
fill_rate_zram = 4000 fill_rate_zram = 4000
Key: max_sleep
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.01 and >= min_sleep
Default value: 3
max_sleep = 3 max_sleep = 3
Key: min_sleep
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.01 and <= max_sleep
Default value: 0.1
min_sleep = 0.1 min_sleep = 0.1
Description:
Type: float
Valid values:
over_sleep = 0.05
############################################################################### ###############################################################################
4. Warnings and notifications 4. Warnings and notifications
4.1. GUI notifications after corrective actions 4.1. GUI notifications after corrective actions
Key: post_action_gui_notifications
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
post_action_gui_notifications = False post_action_gui_notifications = False
Key: hide_corrective_action_type
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
hide_corrective_action_type = False hide_corrective_action_type = False
4.2. Low memory warnings 4.2. Low memory warnings
Key: low_memory_warnings_enabled
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
low_memory_warnings_enabled = False low_memory_warnings_enabled = False
Key: warning_exe
Description: Description:
Type: string Type: string
Valid values: Valid values: any string
Default value: (empty string)
warning_exe = warning_exe =
Key: warning_threshold_min_mem
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [0; 100] %
Default value: 20 %
warning_threshold_min_mem = 20 % warning_threshold_min_mem = 20 %
Key: warning_threshold_min_swap
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: [0; 100] % or >= 0 M
Default value: 20 %
warning_threshold_min_swap = 25 % warning_threshold_min_swap = 25 %
Key: warning_threshold_max_zram
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [0; 100] %
Default value: 45 %
warning_threshold_max_zram = 45 % warning_threshold_max_zram = 45 %
Key: warning_threshold_max_psi
Description: Description:
Type: float Type: float
Valid values: Valid values: from the range [0; 100]
Default value: 10
warning_threshold_max_psi = 10 warning_threshold_max_psi = 10
Key: min_post_warning_delay
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 1
Default value: 60
min_post_warning_delay = 60 min_post_warning_delay = 60
Key: env_cache_time
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 300
env_cache_time = 300 env_cache_time = 300
############################################################################### ###############################################################################
5. Soft threshold 5. Soft threshold (thresholds for sending the SIGTERM signal or
implementing other soft corrective action)
Key: soft_threshold_min_mem
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [0; 50] %
Default value: 5 %
soft_threshold_min_mem = 5 % soft_threshold_min_mem = 5 %
Key: soft_threshold_min_swap
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: [0; 100] % or >= 0 M
Default value: 350 M
soft_threshold_min_swap = 350 M soft_threshold_min_swap = 350 M
Key: soft_threshold_max_zram
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [10; 90] %
Default value: 55 %
soft_threshold_max_zram = 55 % soft_threshold_max_zram = 55 %
Key: soft_threshold_max_psi
Description: Description:
Type: float Type: float
Valid values: Valid values: from the range [5; 100]
Default value: 40
soft_threshold_max_psi = 40 soft_threshold_max_psi = 40
############################################################################### ###############################################################################
6. Hard threshold 6. Hard threshold (thresholds for sending the SIGKILL signal)
Key: hard_threshold_min_mem
Description:
Type: float (with % or M)
Valid values: from the range [0; 50] %
Default value: 2 %
hard_threshold_min_mem = 2 % hard_threshold_min_mem = 2 %
Key: hard_threshold_min_swap
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: [0; 100] % or >= 0 M
Default value: 150 M
hard_threshold_min_swap = 150 M hard_threshold_min_swap = 150 M
Key: hard_threshold_max_zram
Description: Description:
Type: float (+ % or M) Type: float (with % or M)
Valid values: Valid values: from the range [10; 90] %
Default value: 60 %
hard_threshold_max_zram = 65 % hard_threshold_max_zram = 60 %
Key: hard_threshold_max_psi
Description: Description:
Type: float Type: float
Valid values: Valid values: from the range [5; 100]
Default value: 90
hard_threshold_max_psi = 90 hard_threshold_max_psi = 90
@ -234,9 +290,11 @@ hard_threshold_max_psi = 90
7.1. Ignore positive oom_score_adj 7.1. Ignore positive oom_score_adj
Key: ignore_positive_oom_score_adj
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
ignore_positive_oom_score_adj = False ignore_positive_oom_score_adj = False
@ -293,7 +351,7 @@ ignore_positive_oom_score_adj = False
7.2.8. Matching environ with RE patterns 7.2.8. Matching environ with RE patterns
WARNING: using this option can greatly slow down the search for a victim WARNING: using this option can greatly slow down the search for a victim
in conditions of heavily swapping. in conditions of heavy swapping.
@BADNESS_ADJ_RE_ENVIRON 100 /// USER=user @BADNESS_ADJ_RE_ENVIRON 100 /// USER=user
@ -328,45 +386,59 @@ ignore_positive_oom_score_adj = False
9. Misc settings 9. Misc settings
Key: max_soft_exit_time
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.1
Default value: 10
max_soft_exit_time = 10 max_soft_exit_time = 10
Key: post_kill_exe
Description: Description:
Type: string Type: string
Valid values: Valid values: any string
Default value: (empty string)
post_kill_exe = post_kill_exe =
Key: min_badness
Description: Description:
Type: integer Type: integer
Valid values: Valid values: >= 1
Default value: 1
min_badness = 1 min_badness = 1
Key: post_soft_action_delay
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.1
Default value: 3
post_soft_action_delay = 3 post_soft_action_delay = 3
Key: post_zombie_delay
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 0.1
post_zombie_delay = 0.1 post_zombie_delay = 0.1
Key: victim_cache_time
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 10
victim_cache_time = 10 victim_cache_time = 10
Key: exe_timeout
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0.1
Default value: 20
exe_timeout = 20 exe_timeout = 20
@ -374,96 +446,118 @@ exe_timeout = 20
10. Verbosity, debug, logging 10. Verbosity, debug, logging
Key: print_config_at_startup
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
print_config_at_startup = False print_config_at_startup = False
Key: print_mem_check_results
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
print_mem_check_results = False print_mem_check_results = False
Key: min_mem_report_interval
Description: Description:
Type: float Type: float
Valid values: Valid values: >= 0
Default value: 60
min_mem_report_interval = 60 min_mem_report_interval = 60
Key: print_proc_table
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
print_proc_table = False print_proc_table = False
Key: extra_table_info
Description: Description:
WARNING: using "cmdline" or "environ" keys can greatly slow down WARNING: using "cmdline" or "environ" keys can greatly slow down
the search for a victim in conditions of heavily swapping. the search for a victim in conditions of heavy swapping.
Type: string Type: string
Valid values: Valid values: None, cgroup_v1, cgroup_v2, realpath,
None cwd, cmdline, environ
cgroup_v1 Default value: None
cgroup_v2
realpath
cwd
cmdline
environ
extra_table_info = None extra_table_info = None
Key: print_victim_status
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: True
print_victim_status = True print_victim_status = True
Key: print_victim_cmdline
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
print_victim_cmdline = False print_victim_cmdline = False
Key: max_victim_ancestry_depth
Description: Description:
Type: integer Type: integer
Valid values: Valid values: >= 1
Default value: 3
max_victim_ancestry_depth = 3 max_victim_ancestry_depth = 3
Key: print_statistics
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: True
print_statistics = True print_statistics = True
Key: debug_psi
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
debug_psi = False debug_psi = False
Key: debug_gui_notifications
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
debug_gui_notifications = False debug_gui_notifications = False
Key: debug_sleep
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
debug_sleep = False debug_sleep = False
Key: debug_threading
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
debug_threading = False debug_threading = False
Key: separate_log
Description: Description:
Type: boolean Type: boolean
Valid values: True and False Valid values: True | False
Default value: False
separate_log = False separate_log = False

View File

@ -102,12 +102,6 @@ max_sleep = 3
min_sleep = 0.1 min_sleep = 0.1
Description:
Type: float
Valid values:
over_sleep = 0.05
############################################################################### ###############################################################################
4. Warnings and notifications 4. Warnings and notifications