small fixes

This commit is contained in:
Alexey Avramov 2018-11-23 03:16:27 +09:00
parent 3faa07ba95
commit 31a9194a8b
5 changed files with 19 additions and 17 deletions

View File

@ -13,7 +13,7 @@ install:
install -d $(DESTDIR)/$(PREFIX)/etc/nohang install -d $(DESTDIR)/$(PREFIX)/etc/nohang
install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang
install -m0644 ./default_values_backup.conf $(DESTDIR)/$(PREFIX)/etc/nohang install -m0644 ./nohang.conf.backup $(DESTDIR)/$(PREFIX)/etc/nohang
install -d $(DESTDIR)/$(PREFIX)/usr/share/man/man1 install -d $(DESTDIR)/$(PREFIX)/usr/share/man/man1
gzip -k -c nohang.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/nohang.1.gz gzip -k -c nohang.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/nohang.1.gz

16
nohang
View File

@ -1427,8 +1427,8 @@ while True:
if mem_available <= mem_min_sigkill_kb and swap_free <= swap_min_sigkill_kb: if mem_available <= mem_min_sigkill_kb and swap_free <= swap_min_sigkill_kb:
time0 = time() time0 = time()
mem_info = 'Low memory; corrective action required!\n MemAvailable ({} MiB, {} %) < mem_min_sigkill ({} MiB, {} %)\n Swa' \ mem_info = 'Low memory; corrective action required!\n MemAvailable [{} MiB, {} %] <= mem_min_sigkill [{} MiB, {} %]\n Swa' \
'pFree ({} MiB, {} %) < swap_min_sigkill ({} MiB, {} %)'.format( 'pFree [{} MiB, {} %] <= swap_min_sigkill [{} MiB, {} %]'.format(
kib_to_mib(mem_available), kib_to_mib(mem_available),
percent(mem_available / mem_total), percent(mem_available / mem_total),
@ -1447,7 +1447,7 @@ while True:
elif mem_used_zram >= zram_max_sigkill_kb: elif mem_used_zram >= zram_max_sigkill_kb:
time0 = time() time0 = time()
mem_info = 'Low memory; corrective action required!\n MemUsedZram ({} MiB, {} %) > zram_max_sigkill ({} MiB, {} %)'.format( mem_info = 'Low memory; corrective action required!\n MemUsedZram [{} MiB, {} %] >= zram_max_sigkill [{} MiB, {} %]'.format(
kib_to_mib(mem_used_zram), kib_to_mib(mem_used_zram),
percent(mem_used_zram / mem_total), percent(mem_used_zram / mem_total),
kib_to_mib(zram_max_sigkill_kb), kib_to_mib(zram_max_sigkill_kb),
@ -1460,8 +1460,8 @@ while True:
time0 = time() time0 = time()
mem_info = 'Low memory; corrective action required!\n MemAvailable ({} MiB, {} %) < mem_min_sigterm ({} MiB, {} %)\n Sw' \ mem_info = 'Low memory; corrective action required!\n MemAvailable [{} MiB, {} %] <= mem_min_sigterm [{} MiB, {} %]\n Sw' \
'apFree ({} MiB, {} %) < swap_min_sigterm ({} MiB, {} %)'.format( 'apFree [{} MiB, {} %] <= swap_min_sigterm [{} MiB, {} %]'.format(
kib_to_mib(mem_available), kib_to_mib(mem_available),
percent(mem_available / mem_total), percent(mem_available / mem_total),
@ -1485,8 +1485,8 @@ while True:
elif mem_used_zram >= zram_max_sigterm_kb: elif mem_used_zram >= zram_max_sigterm_kb:
time0 = time() time0 = time()
mem_info = 'Low memory; corrective action required!\n MemUsedZram ({} MiB, {} %) > zram_max_sigter' \ mem_info = 'Low memory; corrective action required!\n MemUsedZram [{} MiB, {} %] >= zram_max_sigter' \
'm ({} M, {} %)'.format( 'm [{} M, {} %]'.format(
kib_to_mib(mem_used_zram), kib_to_mib(mem_used_zram),
percent(mem_used_zram / mem_total), percent(mem_used_zram / mem_total),
kib_to_mib(zram_max_sigterm_kb), kib_to_mib(zram_max_sigterm_kb),
@ -1497,7 +1497,7 @@ while True:
# LOW MEMORY WARNINGS # LOW MEMORY WARNINGS
elif gui_low_memory_warnings: elif gui_low_memory_warnings:
if mem_available < mem_min_warnings_kb and swap_free < swap_min_warnings_kb + 0.1 or mem_used_zram > zram_max_warnings_kb: if mem_available <= mem_min_warnings_kb and swap_free <= swap_min_warnings_kb + 0.1 or mem_used_zram >= zram_max_warnings_kb:
warn_time_delta = time() - warn_time_now warn_time_delta = time() - warn_time_now
warn_time_now = time() warn_time_now = time()
warn_timer += warn_time_delta warn_timer += warn_time_delta

View File

@ -26,7 +26,7 @@
1. Thresholds below which a signal should be sent to the victim 1. Thresholds below which a signal should be sent to the victim
Sets the available memory levels below which SIGTERM or SIGKILL Sets the available memory levels at or below which SIGTERM or SIGKILL
signals are sent. The signal will be sent if MemAvailable and signals are sent. The signal will be sent if MemAvailable and
SwapFree (in /proc/meminfo) at the same time will drop below the SwapFree (in /proc/meminfo) at the same time will drop below the
corresponding values. Can be specified in % (percent) and M (MiB). corresponding values. Can be specified in % (percent) and M (MiB).
@ -77,6 +77,8 @@ rate_mem = 6
rate_swap = 3 rate_swap = 3
rate_zram = 1 rate_zram = 1
See also https://github.com/rfjakob/earlyoom/issues/61
##################################################################### #####################################################################
3. The prevention of killing innocent victims 3. The prevention of killing innocent victims
@ -250,18 +252,18 @@ mlockall = False
Valid values are integers from the range [-20; 19]. Valid values are integers from the range [-20; 19].
niceness = -15 niceness = -9
Set oom_score_adj for the nohang process. Set oom_score_adj for the nohang process.
Valid values are integers from the range [-1000; 1000]. Valid values are integers from the range [-1000; 1000].
Setting the values to -1000 will prohibit suicide. Setting the values to -1000 will prohibit suicide.
oom_score_adj = -100 oom_score_adj = -50
Read `man ionice` to understand the following parameters. Read `man ionice` to understand the following parameters.
Setting the True value requires the root privileges. Setting the True value requires the root privileges.
realtime_ionice = True realtime_ionice = False
'For realtime and best-effort, 0-7 are valid data 'For realtime and best-effort, 0-7 are valid data
(priority levels), and 0 represents the highest priority level.' (priority levels), and 0 represents the highest priority level.'

View File

@ -68,9 +68,9 @@ zram_max_warnings = 40 %
7. Preventing the slowing down of the program 7. Preventing the slowing down of the program
mlockall = False mlockall = False
niceness = -15 niceness = -9
oom_score_adj = -100 oom_score_adj = -50
realtime_ionice = True realtime_ionice = False
realtime_ionice_classdata = 4 realtime_ionice_classdata = 4
##################################################################### #####################################################################

View File

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=No hang daemon Description=Highly configurable out of memory preventer
After=sysinit.target After=sysinit.target
Documentation=man:nohang(1) https://github.com/hakavlad/nohang Documentation=man:nohang(1) https://github.com/hakavlad/nohang