From 03a7b521e3ffb7f5d153d90480ba5d4bc29d1e8f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 10 Sep 2015 12:32:16 +0200 Subject: core: add support for the "pids" cgroup controller This adds support for the new "pids" cgroup controller of 4.3 kernels. It allows accounting the number of tasks in a cgroup and enforcing limits on it. This adds two new setting TasksAccounting= and TasksMax= to each unit, as well as a gloabl option DefaultTasksAccounting=. This also updated "cgtop" to optionally make use of the new kernel-provided accounting. systemctl has been updated to show the number of tasks for each service if it is available. This patch also adds correct support for undoing memory limits for units using a MemoryLimit=infinity syntax. We do the same for TasksMax= now and hence keep things in sync here. --- man/systemd-cgtop.xml | 77 +++++++++++++++++++++++++++++----------- man/systemd-system.conf.xml | 22 ++++++------ man/systemd.resource-control.xml | 63 +++++++++++++++++++++++++------- 3 files changed, 119 insertions(+), 43 deletions(-) (limited to 'man') diff --git a/man/systemd-cgtop.xml b/man/systemd-cgtop.xml index 0e0ea3ba7a..859c1a2865 100644 --- a/man/systemd-cgtop.xml +++ b/man/systemd-cgtop.xml @@ -114,7 +114,7 @@ - Order by number of processes in control group. + Order by number of tasks/processes in the control group. @@ -169,26 +169,49 @@ pressing the % key. + + + + Count only userspace processes instead of all + tasks. By default all tasks are counted: each kernel thread + and each userspace thread individually. With this setting + kernel threads are excluded from the counting and each + userspace process only counts as one, regardless how many + threads it consists of. This setting may also be toggled at + runtime by pressing the P key. This option + may not be combined with + . + + - Include kernel threads when counting tasks in - control groups. By default, kernel threads are not included in - the count. This setting may also be toggled at runtime by - pressing the k key. + Count only userspace processes and kernel + threads instead of all tasks. By default all tasks are + counted: each kernel thread and each userspace thread + individually. With this setting kernel threads are included in + the counting and each userspace process only counts as on one, + regardless how many threads it consists of. This setting may + also be toggled at runtime by pressing the k + key. This option may not be combined with + . - Controls whether the number of tasks shown for - a control group shall include all tasks that are contained in - any of the child control groups as well. Takes a boolean - argument, defaults to yes. If enabled the - tasks in child control groups are included, if disabled only - the tasks in the control group itself are counted. This - setting may also be toggled at runtime by pressing the - r key. + Controls whether the number of processes shown + for a control group shall include all processes that are + contained in any of the child control groups as well. Takes a + boolean argument, defaults to yes. If + enabled the processes in child control groups are included, if + disabled only the processes in the control group itself are + counted. This setting may also be toggled at runtime by + pressing the r key. Note that this setting + only applies to process counting, i.e. when the + or options are + used. It has not effect if all tasks are counted, in which + case the counting is always recursive. @@ -286,23 +309,35 @@ switch. + + P + + Toggle between counting all tasks, or only + userspace processes. This setting may also be controlled using + the command line switch (see + above). + + k - Toggle between including or excluding kernel - threads in control group task counts. This setting may also be - controlled using the command line - switch. + Toggle between counting all tasks, or only + userspace processes and kernel threads. This setting may also + be controlled using the command line + switch (see above). r Toggle between recursively including or - excluding tasks in child control groups in control group task - counts. This setting may also be controlled using the - command line - switch. + excluding processes in child control groups in control group + process counts. This setting may also be controlled using the + command line switch. This key is + not available of all tasks are counted, it is only available + if processes are counted, as enabled with the + P or k + keys. diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml index c06accd791..a4ba0959ea 100644 --- a/man/systemd-system.conf.xml +++ b/man/systemd-system.conf.xml @@ -51,14 +51,14 @@ - /etc/systemd/system.conf - /etc/systemd/system.conf.d/*.conf - /run/systemd/system.conf.d/*.conf - /usr/lib/systemd/system.conf.d/*.conf - /etc/systemd/user.conf - /etc/systemd/user.conf.d/*.conf - /run/systemd/user.conf.d/*.conf - /usr/lib/systemd/user.conf.d/*.conf + /etc/systemd/system.conf, + /etc/systemd/system.conf.d/*.conf, + /run/systemd/system.conf.d/*.conf, + /usr/lib/systemd/system.conf.d/*.conf + /etc/systemd/user.conf, + /etc/systemd/user.conf.d/*.conf, + /run/systemd/user.conf.d/*.conf, + /usr/lib/systemd/user.conf.d/*.conf @@ -305,12 +305,14 @@ DefaultCPUAccounting= DefaultBlockIOAccounting= DefaultMemoryAccounting= + DefaultTasksAccounting= Configure the default resource accounting settings, as configured per-unit by CPUAccounting=, - BlockIOAccounting= and - MemoryAccounting=. See + BlockIOAccounting=, + MemoryAccounting= and + TasksAccounting=. See systemd.resource-control5 for details on the per-unit settings. diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml index 8f4e7a3f16..6b9329bbee 100644 --- a/man/systemd.resource-control.xml +++ b/man/systemd.resource-control.xml @@ -103,10 +103,10 @@ Turn on CPU usage accounting for this unit. Takes a boolean argument. Note that turning on CPU accounting for - one unit might also implicitly turn it on for all units + one unit will also implicitly turn it on for all units contained in the same slice and for all its parent slices and the units contained therein. The system default for this - setting maybe controlled with + setting may be controlled with DefaultCPUAccounting= in systemd-system.conf5. @@ -134,7 +134,7 @@ prioritizing specific services at boot-up differently than during normal runtime. - Those options imply + These options imply CPUAccounting=true. @@ -168,9 +168,10 @@ Turn on process and kernel memory accounting for this unit. Takes a boolean argument. Note that turning on memory - accounting for one unit might also implicitly turn it on for - all its parent slices. The system default for this setting - maybe controlled with + accounting for one unit will also implicitly turn it on for + all units contained in the same slice and for all its parent + slices and the units contained therein. The system default + for this setting may be controlled with DefaultMemoryAccounting= in systemd-system.conf5. @@ -186,26 +187,64 @@ 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. This controls the - memory.limit_in_bytes control group - attribute. For details about this control group attribute, - see infinity no memory limit is applied. This + controls the memory.limit_in_bytes + control group attribute. For details about this control + group attribute, see memory.txt. Implies MemoryAccounting=true. + + TasksAccounting= + + + Turn on task accounting for this unit. Takes a + boolean argument. If enabled, the system manager will keep + track of the number of tasks in the unit. The number of + tasks accounted this way includes both kernel threads and + userspace processes, with each thread counting + individually. Note that turning on tasks accounting for one + unit will also implicitly turn it on for all units contained + in the same slice and for all its parent slices and the + units contained therein. The system default for this setting + may be controlled with + DefaultTasksAccounting= in + systemd-system.conf5. + + + + + TasksMax=N + + + Specify the maximum number of tasks that may be + created in the unit. This ensures that the number of tasks + accounted for the unit (see above) stays below a specific + limit. If assigned the special value + infinity no tasks limit is applied. This + controls the pids.max control group + attribute. For details about this control group attribute, + see pids.txt. + + Implies TasksAccounting=true. + + + BlockIOAccounting= Turn on Block IO accounting for this unit. Takes a boolean argument. Note that turning on block IO accounting - for one unit might also implicitly turn it on for all units + for one unit will also implicitly turn it on for all units contained in the same slice and all for its parent slices and the units contained therein. The system default for this - setting maybe controlled with + setting may be controlled with DefaultBlockIOAccounting= in systemd-system.conf5. -- cgit v1.2.3-54-g00ecf