Skip to content

Commit 5647e53

Browse files
dschatzberghtejun
authored andcommitted
cgroup: Documentation: Clarify usage of memory limits
The existing documentation refers to memory.high as the "main mechanism to control memory usage." This seems incorrect to me - memory.high can result in reclaim pressure which simply leads to stalls unless some external component observes and actions on it (e.g. systemd-oomd can be used for this purpose). While this is feasible, users are unaware of this interaction and are led to believe that memory.high alone is an effective mechanism for limiting memory. The documentation should recommend the use of memory.max as the effective way to enforce memory limits - it triggers reclaim and results in OOM kills by itself. Signed-off-by: Dan Schatzberg <[email protected]> Acked-by: Johannes Weiner <[email protected]> Acked-by: Chris Down <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 2bd1103 commit 5647e53

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,23 +1213,25 @@ PAGE_SIZE multiple when read back.
12131213
A read-write single value file which exists on non-root
12141214
cgroups. The default is "max".
12151215

1216-
Memory usage throttle limit. This is the main mechanism to
1217-
control memory usage of a cgroup. If a cgroup's usage goes
1216+
Memory usage throttle limit. If a cgroup's usage goes
12181217
over the high boundary, the processes of the cgroup are
12191218
throttled and put under heavy reclaim pressure.
12201219

12211220
Going over the high limit never invokes the OOM killer and
1222-
under extreme conditions the limit may be breached.
1221+
under extreme conditions the limit may be breached. The high
1222+
limit should be used in scenarios where an external process
1223+
monitors the limited cgroup to alleviate heavy reclaim
1224+
pressure.
12231225

12241226
memory.max
12251227
A read-write single value file which exists on non-root
12261228
cgroups. The default is "max".
12271229

1228-
Memory usage hard limit. This is the final protection
1229-
mechanism. If a cgroup's memory usage reaches this limit and
1230-
can't be reduced, the OOM killer is invoked in the cgroup.
1231-
Under certain circumstances, the usage may go over the limit
1232-
temporarily.
1230+
Memory usage hard limit. This is the main mechanism to limit
1231+
memory usage of a cgroup. If a cgroup's memory usage reaches
1232+
this limit and can't be reduced, the OOM killer is invoked in
1233+
the cgroup. Under certain circumstances, the usage may go
1234+
over the limit temporarily.
12331235

12341236
In default configuration regular 0-order allocations always
12351237
succeed unless OOM killer chooses current task as a victim.
@@ -1238,10 +1240,6 @@ PAGE_SIZE multiple when read back.
12381240
Caller could retry them differently, return into userspace
12391241
as -ENOMEM or silently ignore in cases like disk readahead.
12401242

1241-
This is the ultimate protection mechanism. As long as the
1242-
high limit is used and monitored properly, this limit's
1243-
utility is limited to providing the final safety net.
1244-
12451243
memory.reclaim
12461244
A write-only nested-keyed file which exists for all cgroups.
12471245

0 commit comments

Comments
 (0)