-
Notifications
You must be signed in to change notification settings - Fork 48
/
nohang-desktop.conf.in
633 lines (450 loc) · 16 KB
/
nohang-desktop.conf.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
## This is the configuration file of the nohang daemon.
## The configuration includes the following sections:
## 0. Check kernel messages for OOM events
## 1. Common zram settings
## 2. Common PSI settings
## 3. Poll rate
## 4. Warnings and notifications
## 5. Soft (SIGTERM) threshold
## 6. Hard (SIGKILL) threshold
## 7. Customize victim selection: adjusting badness of processes
## 8. Customize soft corrective actions
## 9. Misc settings
## 10. Verbosity, debug, logging
## WARNING!
## - Lines starting with #, tabs and whitespace characters are comments.
## - Lines starting with @ contain optional parameters that may be repeated.
## - All values are case sensitive.
## - nohang doesn't forbid you to shoot yourself in the foot. Be careful!
## - Restart the daemon after editing the file to apply the new settings.
## - You can find the file with default values here: :TARGET_DATADIR:/nohang/nohang.conf
## To find config keys descriptions see man(8) nohang
###############################################################################
## 0. Check kernel messages for OOM events
# @check_kmsg
## Type: boolean
## Comment/uncomment to disable/enable checking kmsg for OOM events
# @debug_kmsg
## Type: boolean
## Comment/uncomment to disable/enable debug checking kmsg
###############################################################################
1. Common zram settings
Key: zram_checking_enabled
Description:
Type: boolean
Valid values: True | False
Default value: False
zram_checking_enabled = False
###############################################################################
2. Common PSI settings
Key: psi_checking_enabled
Description:
Type: boolean
Valid values: True | False
Default value: True
psi_checking_enabled = True
Key: psi_path
Description:
Type: string
Valid values: any string
Default value: /proc/pressure/memory
psi_path = /proc/pressure/memory
Key: psi_metrics
Description:
Type: string
Valid values: some_avg10, some_avg60, some_avg300,
full_avg10, full_avg60, full_avg300
Default value: full_avg10
psi_metrics = full_avg10
Key: psi_excess_duration
Description:
Type: float
Valid values: >= 0
Default value: 30
psi_excess_duration = 30
Key: psi_post_action_delay
Description:
Type: float
Valid values: >= 10
Default value: 15
psi_post_action_delay = 15
###############################################################################
3. Poll rate
Key: fill_rate_mem
Description:
Type: float
Valid values: >= 100
Default value: 6000
fill_rate_mem = 6000
Key: fill_rate_swap
Description:
Type: float
Valid values: >= 100
Default value: 2000
fill_rate_swap = 2000
Key: fill_rate_zram
Description:
Type: float
Valid values: >= 100
Default value: 4000
fill_rate_zram = 4000
Key: max_sleep
Description:
Type: float
Valid values: >= 0.01 and >= min_sleep
Default value: 3
max_sleep = 3
Key: min_sleep
Description:
Type: float
Valid values: >= 0.01 and <= max_sleep
Default value: 0.1
min_sleep = 0.1
###############################################################################
4. Warnings and notifications
4.1. GUI notifications after corrective actions
Key: post_action_gui_notifications
Description:
Type: boolean
Valid values: True | False
Default value: True
post_action_gui_notifications = True
Key: hide_corrective_action_type
Description:
Type: boolean
Valid values: True | False
Default value: False
hide_corrective_action_type = False
4.2. Low memory warnings
Key: low_memory_warnings_enabled
Description:
Type: boolean
Valid values: True | False
Default value: True
low_memory_warnings_enabled = True
Key: warning_exe
Description:
Type: string
Valid values: any string
Default value: (empty string)
warning_exe =
Key: warning_threshold_min_mem
Description:
Type: float (with % or M)
Valid values: from the range [0; 100] %
Default value: 20 %
warning_threshold_min_mem = 20 %
Key: warning_threshold_min_swap
Description:
Type: float (with % or M)
Valid values: [0; 100] % or >= 0 M
Default value: 20 %
warning_threshold_min_swap = 25 %
Key: warning_threshold_max_zram
Description:
Type: float (with % or M)
Valid values: from the range [0; 100] %
Default value: 45 %
warning_threshold_max_zram = 45 %
Key: warning_threshold_max_psi
Description:
Type: float
Valid values: from the range [0; 100]
Default value: 10
warning_threshold_max_psi = 10
Key: min_post_warning_delay
Description:
Type: float
Valid values: >= 1
Default value: 60
min_post_warning_delay = 60
Key: env_cache_time
Description:
Type: float
Valid values: >= 0
Default value: 300
env_cache_time = 300
###############################################################################
5. Soft threshold (thresholds for sending the SIGTERM signal or
implementing other soft corrective action)
Key: soft_threshold_min_mem
Description:
Type: float (with % or M)
Valid values: from the range [0; 50] %
Default value: 5 %
soft_threshold_min_mem = 5 %
Key: soft_threshold_min_swap
Description:
Type: float (with % or M)
Valid values: [0; 100] % or >= 0 M
Default value: 10 %
soft_threshold_min_swap = 10 %
Key: soft_threshold_max_zram
Description:
Type: float (with % or M)
Valid values: from the range [10; 90] %
Default value: 55 %
soft_threshold_max_zram = 55 %
Key: soft_threshold_max_psi
Description:
Type: float
Valid values: from the range [5; 100]
Default value: 40
soft_threshold_max_psi = 40
###############################################################################
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 %
Key: hard_threshold_min_swap
Description:
Type: float (with % or M)
Valid values: [0; 100] % or >= 0 M
Default value: 4 %
hard_threshold_min_swap = 4 %
Key: hard_threshold_max_zram
Description:
Type: float (with % or M)
Valid values: from the range [10; 90] %
Default value: 60 %
hard_threshold_max_zram = 60 %
Key: hard_threshold_max_psi
Description:
Type: float
Valid values: from the range [5; 100]
Default value: 90
hard_threshold_max_psi = 90
###############################################################################
7. Customize victim selection: adjusting badness of processes
7.1. Ignore positive oom_score_adj
Key: ignore_positive_oom_score_adj
Description:
Type: boolean
Valid values: True | False
Default value: False
ignore_positive_oom_score_adj = False
7.2.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$
Prefer terminating Firefox tabs instead of terminating the entire browser.
(In Chromium and Electron-based apps child processes get oom_score_adj=300
by default.)
@BADNESS_ADJ_RE_NAME 200 /// ^(Web Content|Privileged Cont|file:// Content)$
@BADNESS_ADJ_RE_NAME -200 /// ^(dnf|yum|packagekitd)$
7.2.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.2.3. Matching CGroup_v2-line with RE patterns
@BADNESS_ADJ_RE_CGROUP_V2 100 /// ^/workload
7.2.4. Matching eUIDs with RE patterns
@BADNESS_ADJ_RE_UID -100 /// ^0$
7.2.5. Matching /proc/[pid]/exe realpath with RE patterns
Example:
@BADNESS_ADJ_RE_REALPATH 20 /// ^/usr/bin/foo$
Protect X.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/libexec/Xorg|/usr/lib/xorg/Xorg|/usr/lib/Xorg|/usr/bin/X|/usr/bin/Xorg|/usr/bin/Xwayland|/usr/bin/weston|/usr/bin/sway)$
Protect GNOME.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/gnome-shell|/usr/bin/metacity|/usr/bin/mutter|/usr/lib/gnome-session/gnome-session-binary|/usr/libexec/gnome-session-binary|/usr/libexec/gnome-session-ctl)$
Protect KDE Plasma.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/plasma-desktop|/usr/bin/plasmashell|/usr/bin/plasma_session|/usr/bin/kwin|/usr/bin/kwin_x11|/usr/bin/kwin_wayland)$
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/startplasma-wayland|/usr/lib/x86_64-linux-gnu/libexec/startplasma-waylandsession|/usr/bin/ksmserver)$
Protect Cinnamon.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/cinnamon|/usr/bin/muffin|/usr/bin/cinnamon-session|/usr/bin/cinnamon-launcher)$
Protect Xfce.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/xfwm4|/usr/bin/xfce4-session|/usr/bin/xfce4-panel|/usr/bin/xfdesktop)$
Protect Mate.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/marco|/usr/bin/mate-session|/usr/bin/caja|/usr/bin/mate-panel)$
Protect LXQt.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/lxqt-panel|/usr/bin/pcmanfm-qt|/usr/bin/lxqt-session)$
Protect Budgie Desktop.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/budgie-wm|/usr/bin/budgie-panel)$
Protect other.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/compiz|/usr/bin/openbox|/usr/bin/fluxbox|/usr/bin/awesome|/usr/bin/icewm|/usr/bin/enlightenment|/usr/bin/gala|/usr/bin/wingpanel|/usr/bin/i3)$
Protect display managers.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/sbin/gdm|/usr/sbin/gdm3|/usr/sbin/sddm|/usr/bin/sddm|/usr/lib/x86_64-linux-gnu/sddm/sddm-helper|/usr/bin/slim|/usr/sbin/lightdm|/usr/libexec/gdm-session-worker|/usr/libexec/gdm-wayland-session|/usr/lib/gdm3/gdm-wayland-session|/usr/lib/gdm3/gdm-session-worker)$
@BADNESS_ADJ_RE_REALPATH -200 /// ^/usr/lib/gdm3/
Protect systemd-logind.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/lib/systemd/systemd-logind|/usr/lib/systemd/systemd-logind)$
Protect `systemd --user`.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/lib/systemd/systemd|/usr/lib/systemd/systemd)$
Protect dbus.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/dbus-daemon|/usr/bin/dbus-run-session|/usr/bin/dbus-broker-launcher|/usr/bin/dbus-broker)$
Protect package managers and distro installers.
@BADNESS_ADJ_RE_REALPATH -200 /// ^(/usr/bin/calamares|/usr/bin/dpkg|/usr/bin/pacman|/usr/bin/yay|/usr/bin/pamac|/usr/bin/pamac-daemon|/usr/bin/pamac-manager)$
Prefer stress.
@BADNESS_ADJ_RE_REALPATH 900 /// ^(/usr/bin/stress|/usr/bin/stress-ng)$
7.2.6. Matching /proc/[pid]/cwd realpath with RE patterns
@BADNESS_ADJ_RE_CWD 200 /// ^/home/
7.2.7. Matching cmdlines with RE patterns
WARNING: using this option can greatly slow down the search for a victim
in conditions of heavily swapping.
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.2.8. Matching environ with RE patterns
WARNING: using this option can greatly slow down the search for a victim
in conditions of heavily swapping.
@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
Run the command instead of sending a signal with at soft corrective action
if the victim's name or cgroup matches the regular expression.
Syntax:
KEY REGEXP SEPARATOR COMMAND
@SOFT_ACTION_RE_NAME ^foo$ /// kill -USR1 $PID
@SOFT_ACTION_RE_CGROUP_V1 ^/system\.slice/ /// systemctl restart $SERVICE
@SOFT_ACTION_RE_CGROUP_V2 /foo\.service$ /// systemctl restart $SERVICE
$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
Key: max_soft_exit_time
Description:
Type: float
Valid values: >= 0.1
Default value: 10
max_soft_exit_time = 10
Key: post_kill_exe
Description:
Type: string
Valid values: any string
Default value: (empty string)
post_kill_exe =
Key: min_badness
Description:
Type: integer
Valid values: >= 1
Default value: 1
min_badness = 1
Key: post_soft_action_delay
Description:
Type: float
Valid values: >= 0.1
Default value: 3
post_soft_action_delay = 3
Key: post_zombie_delay
Description:
Type: float
Valid values: >= 0
Default value: 0.1
post_zombie_delay = 0.1
Key: victim_cache_time
Description:
Type: float
Valid values: >= 0
Default value: 10
victim_cache_time = 10
Key: exe_timeout
Description:
Type: float
Valid values: >= 0.1
Default value: 20
exe_timeout = 20
###############################################################################
10. Verbosity, debug, logging
Key: print_config_at_startup
Description:
Type: boolean
Valid values: True | False
Default value: False
print_config_at_startup = False
Key: print_mem_check_results
Description:
Type: boolean
Valid values: True | False
Default value: False
print_mem_check_results = False
Key: min_mem_report_interval
Description:
Type: float
Valid values: >= 0
Default value: 60
min_mem_report_interval = 60
Key: print_proc_table
Description:
Type: boolean
Valid values: True | False
Default value: False
print_proc_table = False
Key: extra_table_info
Description:
WARNING: using "cmdline" or "environ" keys can greatly slow down
the search for a victim in conditions of heavy swapping.
Type: string
Valid values: None, cgroup_v1, cgroup_v2, realpath,
cwd, cmdline, environ
Default value: None
extra_table_info = None
Key: print_victim_status
Description:
Type: boolean
Valid values: True | False
Default value: True
print_victim_status = True
Key: print_victim_cmdline
Description:
Type: boolean
Valid values: True | False
Default value: False
print_victim_cmdline = False
Key: max_victim_ancestry_depth
Description:
Type: integer
Valid values: >= 1
Default value: 3
max_victim_ancestry_depth = 3
Key: print_statistics
Description:
Type: boolean
Valid values: True | False
Default value: True
print_statistics = True
Key: debug_psi
Description:
Type: boolean
Valid values: True | False
Default value: False
debug_psi = False
Key: debug_gui_notifications
Description:
Type: boolean
Valid values: True | False
Default value: False
debug_gui_notifications = False
Key: debug_sleep
Description:
Type: boolean
Valid values: True | False
Default value: False
debug_sleep = False
Key: debug_threading
Description:
Type: boolean
Valid values: True | False
Default value: False
debug_threading = False
Key: separate_log
Description:
Type: boolean
Valid values: True | False
Default value: False
separate_log = False
###############################################################################
Use cases, feature requests and any questions are welcome:
https://github.com/hakavlad/nohang/issues