From a4c1800284e3546bbfab2dc19eb59bcb91c4a2ca Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 10 Nov 2015 16:52:52 +0100 Subject: core: accept time units for time-based resource limits Let's make sure "LimitCPU=30min" can be parsed properly, following the usual logic how we parse time values. Similar for LimitRTTIME=. While we are at it, extend a bit on the man page section about resource limits. Fixes: #1772 --- man/systemd.exec.xml | 86 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 21 deletions(-) (limited to 'man') diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 96298f11ed..2b090871ff 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -568,90 +568,133 @@ of various resources for executed processes. See setrlimit2 for details. Use the string infinity to - configure no limit on a specific resource. The multiplicative suffixes - K (=1024), M (=1024*1024) and so on for G, T, P and E may be used for - resource limits measured in bytes (e.g. LimitAS=16G). + configure no limit on a specific resource. The multiplicative + suffixes K (=1024), M (=1024*1024) and so on for G, T, P and E + may be used for resource limits measured in bytes + (e.g. LimitAS=16G). For the limits referring to time values, + the usual time units ms, s, min, h and so on may be used (see + systemd.time7 + for details). Note that if no time unit is specified for + LimitCPU= the default unit of seconds is + implied, while for LimitRTTIME= the default + unit of microseconds is implied. Also, note that the effective + granularity of the limits might influence their + enforcement. For example, time limits specified for + LimitCPU= will be rounded up implicitly to + multiples of 1s. + + Note that most process resource limits configured with + these options are per-process, and processes may fork in order + to acquire a new set of resources that are accounted + independently of the original process, and may thus escape + limits set. Also note that LimitRSS= is not + implemented on Linux, and setting it has no effect. Often it + is advisable to prefer the resource controls listed in + systemd.resource-control5 + over these per-process limits, as they apply to services as a + whole, may be altered dynamically at runtime, and are + generally more expressive. For example, + MemoryLimit= is a more powerful (and + working) replacement for LimitRSS=. Limit directives and their equivalent with ulimit - + + Directive ulimit equivalent + Unit - LimitCPU + LimitCPU= ulimit -t + Seconds - LimitFSIZE + LimitFSIZE= ulimit -f + Bytes - LimitDATA + LimitDATA= ulimit -d + Bytes - LimitSTACK + LimitSTACK= ulimit -s + Bytes - LimitCORE + LimitCORE= ulimit -c + Bytes - LimitRSS + LimitRSS= ulimit -m + Bytes - LimitNOFILE + LimitNOFILE= ulimit -n + Number of File Descriptors - LimitAS + LimitAS= ulimit -v + Bytes - LimitNPROC + LimitNPROC= ulimit -u + Number of Processes - LimitMEMLOCK + LimitMEMLOCK= ulimit -l + Bytes - LimitLOCKS + LimitLOCKS= ulimit -x + Number of Locks - LimitSIGPENDING + LimitSIGPENDING= ulimit -i + Number of Queued Signals - LimitMSGQUEUE + LimitMSGQUEUE= ulimit -q + Bytes - LimitNICE + LimitNICE= ulimit -e + Nice Level - LimitRTPRIO + LimitRTPRIO= ulimit -r + Realtime Priority - LimitRTTIME + LimitRTTIME= No equivalent + Microseconds -
+ @@ -1320,6 +1363,7 @@ systemd.mount5, systemd.kill5, systemd.resource-control5, + systemd.time7, systemd.directives7, tmpfiles.d5, exec3 -- cgit v1.2.3-54-g00ecf