nohang/test.conf
2019-09-24 01:56:03 +09:00

473 lines
8.8 KiB
Plaintext

This is nohang config file.
Lines starting with #, tabs and spaces are comments.
Lines starting with @ contain optional parameters.
All values are case sensitive.
Be careful: nohang doesn't forbid you to shoot yourself in the foot.
The configuration includes the following sections:
1. Common zram settings
2. Common PSI settings
3. Poll rate
4. Warnings and notifications
5. Soft threshold
6. Hard threshold
7. Customize victim selection: adjusting badness of processes
8. Customize soft corrective actions
9. Misc settings
10. Verbosity, debug, logging
Just read the description of the parameters and edit the values.
Please restart the program after editing the config.
TODO: improve descriptions
###############################################################################
1. Common zram settings
Key: zram_checking_enabled
Description:
Type: boolean
Valid values: True and False
Default value: False
zram_checking_enabled = True
###############################################################################
2. Common PSI settings
Description:
Type: boolean
Valid values: True and False
psi_checking_enabled = True
Description:
Type: string
Valid values:
psi_path = /proc/pressure/memory
Description:
Type: string
Valid values:
psi_metrics = some_avg10
Description:
Type: float
Valid values:
psi_excess_duration = 60
Description:
Type: float
Valid values:
psi_post_action_delay = 60
###############################################################################
3. Poll rate
Description:
Type: float
Valid values:
fill_rate_mem = 4000
Description:
Type: float
Valid values:
fill_rate_swap = 1500
Description:
Type: float
Valid values:
fill_rate_zram = 6000
Description:
Type: float
Valid values:
max_sleep = 3
Description:
Type: float
Valid values:
min_sleep = 0.1
Description:
Type: float
Valid values:
over_sleep = 0.05
###############################################################################
4. Warnings and notifications
Description:
Type: boolean
Valid values: True and False
post_action_gui_notifications = True
Description:
Type: boolean
Valid values: True and False
low_memory_warnings_enabled = True
Description:
Type: string
Valid values:
warning_exe =
Description:
Type: float (+ % or M)
Valid values:
warning_threshold_min_mem = 20 %
Description:
Type: float (+ % or M)
Valid values:
warning_threshold_min_swap = 20 %
Description:
Type: float (+ % or M)
Valid values:
warning_threshold_max_zram = 50 %
Description:
Type: float
Valid values:
warning_threshold_max_psi = 100
Description:
Type: float
Valid values:
min_post_warning_delay = 30
Description:
Type: float
Valid values:
env_cache_time = 300
###############################################################################
5. Soft threshold
Description:
Type: float (+ % or M)
Valid values:
soft_threshold_min_mem = 8 %
Description:
Type: float (+ % or M)
Valid values:
soft_threshold_min_swap = 8 %
Description:
Type: float (+ % or M)
Valid values:
soft_threshold_max_zram = 60 %
Description:
Type: float
Valid values:
soft_threshold_max_psi = 60
###############################################################################
6. Hard threshold
hard_threshold_min_mem = 4 %
Description:
Type: float (+ % or M)
Valid values:
hard_threshold_min_swap = 4 %
Description:
Type: float (+ % or M)
Valid values:
hard_threshold_max_zram = 65 %
Description:
Type: float
Valid values:
hard_threshold_max_psi = 90
###############################################################################
7. Customize victim selection: adjusting badness of processes
7.1. Ignore positive oom_score_adj
Description:
Type: boolean
Valid values: True and False
ignore_positive_oom_score_adj = True
7.2. Forbid negative badness
Description:
Type: boolean
Valid values: True and False
forbid_negative_badness = True
7.3.1. Matching process names with RE patterns change their badness
Syntax:
@BADNESS_ADJ_RE_NAME badness_adj /// RE_pattern
New badness value will be += badness_adj
It is possible to compare multiple patterns
with different badness_adj values.
Example:
@BADNESS_ADJ_RE_NAME -500 /// ^sshd$
7.3.2. Matching CGroup_v1-line with RE patterns
@BADNESS_ADJ_RE_CGROUP_V1 -50 /// ^/system\.slice/
@BADNESS_ADJ_RE_CGROUP_V1 50 /// /foo\.service$
@BADNESS_ADJ_RE_CGROUP_V1 -50 /// ^/user\.slice/
7.3.3. Matching CGroup_v2-line with RE patterns
@BADNESS_ADJ_RE_CGROUP_V2 100 /// ^/workload
7.3.4. Matching eUIDs with RE patterns
@BADNESS_ADJ_RE_UID -100 /// ^0$
7.3.5. Matching realpath with RE patterns
@BADNESS_ADJ_RE_REALPATH 20 /// ^/usr/bin/foo
7.3.5.1. Matching cwd with RE patterns
@BADNESS_ADJ_RE_CWD 20 /// ^/home/
7.3.6. Matching cmdlines with RE patterns
@BADNESS_ADJ_RE_CMDLINE 2000 /// ^/bin/sleep
Prefer chromium tabs and electron-based apps
@BADNESS_ADJ_RE_CMDLINE 200 /// --type=renderer
Prefer firefox tabs (Web Content and WebExtensions)
@BADNESS_ADJ_RE_CMDLINE 100 /// -appomni
@BADNESS_ADJ_RE_CMDLINE -200 /// ^/usr/lib/virtualbox
7.3.7. Matching environ with RE patterns
@BADNESS_ADJ_RE_ENVIRON 100 /// USER=user
Note that you can control badness also via systemd units via
OOMScoreAdjust, see
www.freedesktop.org/software/systemd/man/systemd.exec.html#OOMScoreAdjust=
###############################################################################
8. Customize soft corrective actions
TODO: docs
Syntax:
KEY REGEXP SEPARATOR COMMAND
@SOFT_ACTION_RE_NAME ^tail$ /// kill -SEGV $PID
@SOFT_ACTION_RE_NAME ^foo$ /// kill -SEGV $PID
@SOFT_ACTION_RE_NAME ^bash$ /// kill -9 $PID
@SOFT_ACTION_RE_CGROUP_V1 ^/system\.slice/ /// systemctl restart $SERVICE
@SOFT_ACTION_RE_CGROUP_V1 /foo\.service$ /// systemctl restart $SERVICE
@SOFT_ACTION_RE_NAME ^tail$ /// kill -TERM $PID
$PID will be replaced by process PID.
$NAME will be replaced by process name.
$SERVICE will be replaced by .service if it exists (overwise it will be
relpaced by empty line)
###############################################################################
9. Misc settings
Description:
Type: float
Valid values:
max_soft_exit_time = 10
Description:
Type: string
Valid values:
post_kill_exe =
Description:
Type: integer
Valid values:
min_badness = 10
Description:
Type: float
Valid values:
post_soft_action_delay = 3
Description:
Type: float
Valid values:
post_zombie_delay = 0.1
Description:
Type: float
Valid values:
victim_cache_time = 10
Description:
Type: float
Valid values:
exe_timeout = 20
###############################################################################
10. Verbosity, debug, logging
Description:
Type: boolean
Valid values: True and False
print_config_at_startup = True
Description:
Type: boolean
Valid values: True and False
print_mem_check_results = True
Description:
Type: float
Valid values:
min_mem_report_interval = 0
Description:
Type: boolean
Valid values: True and False
print_proc_table = True
Description:
Type: string
Valid values:
None
cgroup_v1
cgroup_v2
realpath
cwd
cmdline
environ
extra_table_info = None
Description:
Type: boolean
Valid values: True and False
print_victim_status = True
Description:
Type: boolean
Valid values: True and False
print_victim_cmdline = True
Description:
Type: integer
Valid values:
max_victim_ancestry_depth = 99
Description:
Type: boolean
Valid values: True and False
print_statistics = True
Description:
Type: boolean
Valid values: True and False
debug_psi = True
Description:
Type: boolean
Valid values: True and False
debug_gui_notifications = True
Description:
Type: boolean
Valid values: True and False
debug_sleep = True
Description:
Type: boolean
Valid values: True and False
debug_threading = True
Description:
Type: boolean
Valid values: True and False
separate_log = True
###############################################################################
Use cases, feature requests and any questions are welcome:
https://github.com/hakavlad/nohang/issues