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 -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
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:
time0 = time()
mem_info = 'Low memory; corrective action required!\n MemAvailable ({} MiB, {} %) < mem_min_sigkill ({} MiB, {} %)\n Swa' \
'pFree ({} MiB, {} %) < swap_min_sigkill ({} MiB, {} %)'.format(
mem_info = 'Low memory; corrective action required!\n MemAvailable [{} MiB, {} %] <= mem_min_sigkill [{} MiB, {} %]\n Swa' \
'pFree [{} MiB, {} %] <= swap_min_sigkill [{} MiB, {} %]'.format(
kib_to_mib(mem_available),
percent(mem_available / mem_total),
@ -1447,7 +1447,7 @@ while True:
elif mem_used_zram >= zram_max_sigkill_kb:
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),
percent(mem_used_zram / mem_total),
kib_to_mib(zram_max_sigkill_kb),
@ -1460,8 +1460,8 @@ while True:
time0 = time()
mem_info = 'Low memory; corrective action required!\n MemAvailable ({} MiB, {} %) < mem_min_sigterm ({} MiB, {} %)\n Sw' \
'apFree ({} MiB, {} %) < swap_min_sigterm ({} MiB, {} %)'.format(
mem_info = 'Low memory; corrective action required!\n MemAvailable [{} MiB, {} %] <= mem_min_sigterm [{} MiB, {} %]\n Sw' \
'apFree [{} MiB, {} %] <= swap_min_sigterm [{} MiB, {} %]'.format(
kib_to_mib(mem_available),
percent(mem_available / mem_total),
@ -1485,8 +1485,8 @@ while True:
elif mem_used_zram >= zram_max_sigterm_kb:
time0 = time()
mem_info = 'Low memory; corrective action required!\n MemUsedZram ({} MiB, {} %) > zram_max_sigter' \
'm ({} M, {} %)'.format(
mem_info = 'Low memory; corrective action required!\n MemUsedZram [{} MiB, {} %] >= zram_max_sigter' \
'm [{} M, {} %]'.format(
kib_to_mib(mem_used_zram),
percent(mem_used_zram / mem_total),
kib_to_mib(zram_max_sigterm_kb),
@ -1497,7 +1497,7 @@ while True:
# 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_now = time()
warn_timer += warn_time_delta

View File

@ -26,7 +26,7 @@
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
SwapFree (in /proc/meminfo) at the same time will drop below the
corresponding values. Can be specified in % (percent) and M (MiB).
@ -77,6 +77,8 @@ rate_mem = 6
rate_swap = 3
rate_zram = 1
See also https://github.com/rfjakob/earlyoom/issues/61
#####################################################################
3. The prevention of killing innocent victims
@ -250,18 +252,18 @@ mlockall = False
Valid values are integers from the range [-20; 19].
niceness = -15
niceness = -9
Set oom_score_adj for the nohang process.
Valid values are integers from the range [-1000; 1000].
Setting the values to -1000 will prohibit suicide.
oom_score_adj = -100
oom_score_adj = -50
Read `man ionice` to understand the following parameters.
Setting the True value requires the root privileges.
realtime_ionice = True
realtime_ionice = False
'For realtime and best-effort, 0-7 are valid data
(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
mlockall = False
niceness = -15
oom_score_adj = -100
realtime_ionice = True
niceness = -9
oom_score_adj = -50
realtime_ionice = False
realtime_ionice_classdata = 4
#####################################################################

View File

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