From: Benjamin Berg Date: Fri, 24 Jul 2020 11:17:23 +0000 (+0200) Subject: man: Improve MemoryMin=/MemoryLow= description X-Git-Tag: v247-rc1~399^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16559%2Fhead;p=thirdparty%2Fsystemd.git man: Improve MemoryMin=/MemoryLow= description The description didn't really explain how the distribution mechanism works exactly and the relationship of leaf and slice units. Update the documentation and also explicitly explain the expected behaviour as it is created by the memory_recursiveprot cgroup2 mount option. --- diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml index 3ccb5c49271..744a5f98ce6 100644 --- a/man/systemd.resource-control.xml +++ b/man/systemd.resource-control.xml @@ -261,53 +261,42 @@ - MemoryMin=bytes + MemoryMin=bytes, MemoryLow=bytes - Specify the memory usage protection of the executed processes in this unit. If the memory usages of - this unit and all its ancestors are below their minimum boundaries, this unit's memory won't be reclaimed. - - Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is - parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a - percentage value may be specified, which is taken relative to the installed physical memory on the - system. If assigned the special value infinity, all available memory is protected, which may be - useful in order to always inherit all of the protection afforded by ancestors. - This controls the memory.min control group attribute. For details about this - control group attribute, see Memory Interface Files. - - This setting is supported only if the unified control group hierarchy is used and disables - MemoryLimit=. - - Units may have their children use a default memory.min value by specifying - DefaultMemoryMin=, which has the same semantics as MemoryMin=. This setting - does not affect memory.min in the unit itself. - - - - - MemoryLow=bytes - - - Specify the best-effort memory usage protection of the executed processes in this unit. If the memory - usages of this unit and all its ancestors are below their low boundaries, this unit's memory won't be - reclaimed as long as memory can be reclaimed from unprotected units. + Specify the memory usage protection of the executed processes in this unit. + When reclaiming memory, the unit is treated as if it was using less memory resulting in memory + to be preferentially reclaimed from unprotected units. + Using MemoryLow= results in a weaker protection where memory may still + be reclaimed to avoid invoking the OOM killer in case there is no other reclaimable memory. + + For a protection to be effective, it is generally required to set a corresponding + allocation on all ancestors, which is then distributed between children + (with the exception of the root slice). + Any MemoryMin= or MemoryLow= allocation that is not + explicitly distributed to specific children is used to create a shared protection for all children. + As this is a shared protection, the children will freely compete for the memory. Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a percentage value may be specified, which is taken relative to the installed physical memory on the system. If assigned the special value infinity, all available memory is protected, which may be useful in order to always inherit all of the protection afforded by ancestors. - This controls the memory.low control group attribute. For details about this - control group attribute, see memory.min or memory.low control group attribute. + For details about this control group attribute, see Memory Interface Files. This setting is supported only if the unified control group hierarchy is used and disables MemoryLimit=. - Units may have their children use a default memory.low value by specifying - DefaultMemoryLow=, which has the same semantics as MemoryLow=. This setting - does not affect memory.low in the unit itself. + Units may have their children use a default memory.min or + memory.low value by specifying DefaultMemoryMin= or + DefaultMemoryLow=, which has the same semantics as + MemoryMin= and MemoryLow=. + This setting does not affect memory.min or memory.low + in the unit itself. + Using it to set a default child allocation is only useful on kernels older than 5.7, + which do not support the memory_recursiveprot cgroup2 mount option.