Commit 5647e53f authored by Dan Schatzberg's avatar Dan Schatzberg Committed by Tejun Heo

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: default avatarDan Schatzberg <schatzberg.dan@gmail.com>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarChris Down <chris@chrisdown.name>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 2bd11033
...@@ -1213,23 +1213,25 @@ PAGE_SIZE multiple when read back. ...@@ -1213,23 +1213,25 @@ PAGE_SIZE multiple when read back.
A read-write single value file which exists on non-root A read-write single value file which exists on non-root
cgroups. The default is "max". cgroups. The default is "max".
Memory usage throttle limit. This is the main mechanism to Memory usage throttle limit. If a cgroup's usage goes
control memory usage of a cgroup. If a cgroup's usage goes
over the high boundary, the processes of the cgroup are over the high boundary, the processes of the cgroup are
throttled and put under heavy reclaim pressure. throttled and put under heavy reclaim pressure.
Going over the high limit never invokes the OOM killer and Going over the high limit never invokes the OOM killer and
under extreme conditions the limit may be breached. under extreme conditions the limit may be breached. The high
limit should be used in scenarios where an external process
monitors the limited cgroup to alleviate heavy reclaim
pressure.
memory.max memory.max
A read-write single value file which exists on non-root A read-write single value file which exists on non-root
cgroups. The default is "max". cgroups. The default is "max".
Memory usage hard limit. This is the final protection Memory usage hard limit. This is the main mechanism to limit
mechanism. If a cgroup's memory usage reaches this limit and memory usage of a cgroup. If a cgroup's memory usage reaches
can't be reduced, the OOM killer is invoked in the cgroup. this limit and can't be reduced, the OOM killer is invoked in
Under certain circumstances, the usage may go over the limit the cgroup. Under certain circumstances, the usage may go
temporarily. over the limit temporarily.
In default configuration regular 0-order allocations always In default configuration regular 0-order allocations always
succeed unless OOM killer chooses current task as a victim. succeed unless OOM killer chooses current task as a victim.
...@@ -1238,10 +1240,6 @@ PAGE_SIZE multiple when read back. ...@@ -1238,10 +1240,6 @@ PAGE_SIZE multiple when read back.
Caller could retry them differently, return into userspace Caller could retry them differently, return into userspace
as -ENOMEM or silently ignore in cases like disk readahead. as -ENOMEM or silently ignore in cases like disk readahead.
This is the ultimate protection mechanism. As long as the
high limit is used and monitored properly, this limit's
utility is limited to providing the final safety net.
memory.reclaim memory.reclaim
A write-only nested-keyed file which exists for all cgroups. A write-only nested-keyed file which exists for all cgroups.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment