fix conf
This commit is contained in:
parent
67d9c3295e
commit
e93bfd35fe
64
nohang
64
nohang
@ -1794,6 +1794,8 @@ print('Config:', config)
|
||||
config_dict = dict()
|
||||
|
||||
processname_re_list = []
|
||||
|
||||
|
||||
cmdline_re_list = []
|
||||
environ_re_list = []
|
||||
uid_re_list = []
|
||||
@ -1915,6 +1917,52 @@ except FileNotFoundError:
|
||||
exit(1)
|
||||
|
||||
|
||||
|
||||
if processname_re_list == []:
|
||||
regex_matching = False
|
||||
else:
|
||||
regex_matching = True
|
||||
|
||||
|
||||
if cmdline_re_list == []:
|
||||
re_match_cmdline = False
|
||||
else:
|
||||
re_match_cmdline = True
|
||||
|
||||
|
||||
if uid_re_list == []:
|
||||
re_match_uid = False
|
||||
else:
|
||||
re_match_uid = True
|
||||
|
||||
|
||||
if environ_re_list == []:
|
||||
re_match_environ = False
|
||||
else:
|
||||
re_match_environ = True
|
||||
|
||||
|
||||
if realpath_re_list == []:
|
||||
re_match_realpath = False
|
||||
else:
|
||||
re_match_realpath = True
|
||||
|
||||
|
||||
if cgroup_v1_re_list == []:
|
||||
re_match_cgroup_v1 = False
|
||||
else:
|
||||
re_match_cgroup_v1 = True
|
||||
|
||||
if cgroup_v2_re_list == []:
|
||||
re_match_cgroup_v2 = False
|
||||
else:
|
||||
re_match_cgroup_v2 = True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# print(processname_re_list)
|
||||
# print(cmdline_re_list)
|
||||
# print(uid_re_list)
|
||||
@ -1943,13 +1991,15 @@ gui_notifications = conf_parse_bool('gui_notifications')
|
||||
decrease_oom_score_adj = conf_parse_bool('decrease_oom_score_adj')
|
||||
execute_the_command = conf_parse_bool('execute_the_command')
|
||||
ignore_psi = conf_parse_bool('ignore_psi')
|
||||
regex_matching = conf_parse_bool('regex_matching')
|
||||
re_match_cmdline = conf_parse_bool('re_match_cmdline')
|
||||
re_match_uid = conf_parse_bool('re_match_uid')
|
||||
re_match_cgroup_v1 = conf_parse_bool('re_match_cgroup_v1')
|
||||
re_match_cgroup_v2 = conf_parse_bool('re_match_cgroup_v2')
|
||||
re_match_realpath = conf_parse_bool('re_match_realpath')
|
||||
re_match_environ = conf_parse_bool('re_match_environ')
|
||||
|
||||
|
||||
# regex_matching = conf_parse_bool('regex_matching')
|
||||
# re_match_cmdline = conf_parse_bool('re_match_cmdline')
|
||||
# re_match_uid = conf_parse_bool('re_match_uid')
|
||||
# re_match_cgroup_v1 = conf_parse_bool('re_match_cgroup_v1')
|
||||
# re_match_cgroup_v2 = conf_parse_bool('re_match_cgroup_v2')
|
||||
# re_match_realpath = conf_parse_bool('re_match_realpath')
|
||||
# re_match_environ = conf_parse_bool('re_match_environ')
|
||||
|
||||
|
||||
# if regex_matching or re_match_cmdline or re_match_uid or re_match_cgroup
|
||||
|
29
nohang.conf
29
nohang.conf
@ -11,11 +11,12 @@
|
||||
4. The prevention of killing innocent victims
|
||||
5. Impact on the badness of processes via matching their
|
||||
- names,
|
||||
- cgroups,
|
||||
- cmdlines and
|
||||
- UIDs
|
||||
with regular expressions
|
||||
6. The execution of a specific command instead of sending the
|
||||
SIGTERM signal
|
||||
6. Customize corrective actions: the execution of a specific command
|
||||
instead of sending the SIGTERM signal
|
||||
7. GUI notifications:
|
||||
- OOM prevention results and
|
||||
- low memory warnings
|
||||
@ -173,10 +174,6 @@ oom_score_adj_max = 20
|
||||
|
||||
5.1 Matching process names with RE patterns
|
||||
|
||||
Valid values are True and False.
|
||||
|
||||
regex_matching = False
|
||||
|
||||
Syntax:
|
||||
|
||||
@PROCESSNAME_RE badness_adj /// RE_pattern
|
||||
@ -188,60 +185,42 @@ regex_matching = False
|
||||
|
||||
Example:
|
||||
|
||||
@PROCESSNAME_RE -100 /// ^Xorg$
|
||||
@PROCESSNAME_RE 1000 /// ^Xorg$
|
||||
|
||||
@PROCESSNAME_RE -500 /// ^sshd$
|
||||
|
||||
|
||||
5.2 Matching cmdlines with RE patterns
|
||||
|
||||
A good option that allows fine adjustment.
|
||||
|
||||
re_match_cmdline = False
|
||||
|
||||
@CMDLINE_RE 300 /// -childID|--type=renderer
|
||||
|
||||
@CMDLINE_RE -200 /// ^/usr/lib/virtualbox
|
||||
|
||||
|
||||
5.3 Matching UIDs with RE patterns
|
||||
|
||||
The most slow option
|
||||
|
||||
re_match_uid = False
|
||||
|
||||
@UID_RE -100 /// ^0$
|
||||
|
||||
|
||||
5.4 Matching CGroup-line with RE patterns
|
||||
|
||||
re_match_cgroup_v1 = False
|
||||
|
||||
@CGROUP_V1_RE -50 /// ^/system.slice
|
||||
|
||||
@CGROUP_V1_RE 50 /// foo.service
|
||||
|
||||
@CGROUP_V1_RE -50 /// ^/user.slice
|
||||
|
||||
re_match_cgroup_v2 = False
|
||||
|
||||
@CGROUP_V2_RE 100 /// ^/workload
|
||||
|
||||
|
||||
5.5 Matching realpath with RE patterns
|
||||
|
||||
re_match_realpath = False
|
||||
|
||||
@REALPATH_RE 20 /// ^/usr/bin/foo
|
||||
|
||||
|
||||
5.6 Matching environ with RE patterns
|
||||
|
||||
re_match_environ = False
|
||||
|
||||
@ENVIRON_RE 100 /// USER=user
|
||||
|
||||
|
||||
Note that you can control badness also via systemd units via OOMScoreAdjust, see
|
||||
https://www.freedesktop.org/software/systemd/man/systemd.exec.html#OOMScoreAdjust=
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user