1earlyoom(1) General Commands Manual earlyoom(1)
2
3
4
6 earlyoom - Early OOM Daemon
7
9 earlyoom [OPTION]...
10
12 The oom-killer generally has a bad reputation among Linux users. One
13 may have to sit in front of an unresponsive system, listening to the
14 grinding disk for minutes, and press the reset button to quickly get
15 back to what one was doing after running out of patience.
16
17 earlyoom checks the amount of available memory and free swap up to 10
18 times a second (less often if there is a lot of free memory). If both
19 memory and swap are below 10%, it will kill the largest process (high‐
20 est oom_score). The percentage value is configurable via command line
21 arguments.
22
23 If there is a failure when trying to kill a process, earlyoom sleeps
24 for 1 second to limit log spam due to recurring errors.
25
27 -m PERCENT[,KILL_PERCENT]
28 set available memory minimum to PERCENT of total (default 10 %).
29
30 earlyoom starts sending SIGTERM once both memory and swap are below
31 their respective PERCENT setting. It sends SIGKILL once both are below
32 their respective KILL_PERCENT setting (default PERCENT/2).
33
34 Use the same value for PERCENT and KILL_PERCENT if you always want to
35 use SIGKILL.
36
37 Examples:
38
39 earlyoom # sets PERCENT=10, KILL_PERCENT=5
40 earlyoom -m 30 # sets PERCENT=30, KILL_PERCENT=15
41 earlyoom -m 20,18 # sets PERCENT=20, KILL_PERCENT=18
42
43 -s PERCENT[,KILL_PERCENT]
44 set free swap minimum to PERCENT of total (default 10 %). Send SIGKILL
45 if at or below KILL_PERCENT (default PERCENT/2), otherwise SIGTERM.
46
47 You can use -s 100 to have earlyoom effectively ignore swap usage: Pro‐
48 cesses are killed once available memory drops below the configured min‐
49 imum, no matter how much swap is free.
50
51 Use the same value for PERCENT and KILL_PERCENT if you always want to
52 use SIGKILL.
53
54 -M SIZE[,KILL_SIZE]
55 As an alternative to specifying a percentage of total memory, -M sets
56 the available memory minimum to SIZE KiB. The value is internally con‐
57 verted to a percentage. If you pass both -M and -m, the lower value is
58 used. Example: Reserve 10% of RAM but at most 1 GiB:
59
60 earlyoom -m 10 -M 1048576
61
62 earlyoom sends SIGKILL if at or below KILL_SIZE (default SIZE/2), oth‐
63 erwise SIGTERM.
64
65 -S SIZE[,KILL_SIZE]
66 As an alternative to specifying a percentage of total swap, -S sets the
67 free swap minimum to SIZE KiB. The value is internally converted to a
68 percentage. If you pass both -S and -s, the lower value is used.
69
70 Send SIGKILL if at or below KILL_SIZE (default SIZE/2), otherwise
71 SIGTERM.
72
73 -k
74 removed in earlyoom v1.2, ignored for compatibility
75
76 -i
77 user-space oom killer should ignore positive oom_score_adj values
78
79 -d
80 enable debugging messages
81
82 -v
83 print version information and exit
84
85 -r INTERVAL
86 Time between printing periodic memory reports, in seconds (default
87 1.0). A memory report looks like this:
88
89 mem avail: 21790 of 23909 MiB (91.14%), swap free: 0 of 0 MiB ( 0.00%)
90
91 Set to 3600 to print a report every hour, to 86400 to print once a day
92 etc. Set to 0 to disable printing periodic memory reports. Free memo‐
93 ry monitoring and low-memory killing runs independently of this option
94 at an adaptive poll rate that only depends on free memory. Due to the
95 adaptive poll rate, when there is a lot of free memory, the actual in‐
96 terval may be up to 1 second longer than the setting.
97
98 -p
99 Increase earlyoom’s priority: set niceness of earlyoom to -20 and
100 oom_score_adj to -100.
101
102 When earlyoom is run through its default systemd service, the -p switch
103 doesn’t work. To achieve the same effect, enter the following three
104 lines into sudo systemctl edit earlyoom:
105
106 [Service]
107 OOMScoreAdjust=-100
108 Nice=-20
109
110 -n
111 Enable notifications via d-bus.
112
113 --prefer REGEX
114 prefer killing processes matching REGEX (adds 300 to oom_score)
115
116 --avoid REGEX
117 avoid killing processes matching REGEX (subtracts 300 from oom_score)
118
119 --dryrun
120 dry run (do not kill any processes)
121
122 -h, --help
123 this help text
124
126 0: Successful program execution.
127
128 1: Other error - inspect message for details
129
130 2: Switch conflict.
131
132 4: Could not cd to /proc
133
134 5: Could not open proc
135
136 7: Could not open /proc/sysrq-trigger
137
138 13: Unknown options.
139
140 14: Wrong parameters for other options.
141
142 15: Wrong parameters for memory threshold.
143
144 16: Wrong parameters for swap threshold.
145
146 102: Could not open /proc/meminfo
147
148 103: Could not read /proc/meminfo
149
150 104: Could not find a specific entry in /proc/meminfo
151
152 105: Could not convert number when parse the contents of /proc/meminfo
153
155 Earlyoom does not use echo f > /proc/sysrq-trigger because the Chrome
156 people made their browser always be the first (innocent!) victim by
157 setting oom_score_adj very high. Instead, earlyoom finds out itself by
158 reading through /proc/*/status (actually /proc/*/statm, which contains
159 the same information but is easier to parse programmatically).
160
161 Additionally, in recent kernels (tested on 4.0.5), triggering the ker‐
162 nel oom killer manually may not work at all. That is, it may only free
163 some graphics memory (that will be allocated immediately again) and not
164 actually kill any process.
165
167 About 2 MiB VmRSS. All memory is locked using mlockall() to make sure
168 earlyoom does not slow down in low memory situations.
169
171 If there is zero total swap on earlyoom startup, any -S (uppercase “S”)
172 values are ignored, a warning is printed, and default swap percentages
173 are used.
174
175 For processes matched by --prefer, negative oom_score_adj values are
176 not taken into account, and the process gets an effective oom_score of
177 at least 300. See https://github.com/rfjakob/earlyoom/issues/159 for
178 details.
179
181 The author of earlyoom is Jakob Unterwurzacher ⟨jakobunt@gmail.com⟩.
182
183 This manual page was written by Yangfl ⟨mmyangfl@gmail.com⟩, for the
184 Debian project (and may be used by others).
185
186
187
188 earlyoom(1)