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. --- src/core/cgroup.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/core/cgroup.h') diff --git a/src/core/cgroup.h b/src/core/cgroup.h index 438f5bf50f..3ba09d56a4 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -72,6 +72,7 @@ struct CGroupContext { bool cpu_accounting; bool blockio_accounting; bool memory_accounting; + bool tasks_accounting; unsigned long cpu_shares; unsigned long startup_cpu_shares; @@ -88,6 +89,8 @@ struct CGroupContext { LIST_HEAD(CGroupDeviceAllow, device_allow); bool delegate; + + uint64_t tasks_max; }; #include "unit.h" @@ -137,6 +140,7 @@ int unit_search_main_pid(Unit *u, pid_t *ret); int unit_watch_all_pids(Unit *u); int unit_get_memory_current(Unit *u, uint64_t *ret); +int unit_get_tasks_current(Unit *u, uint64_t *ret); int unit_get_cpu_usage(Unit *u, nsec_t *ret); int unit_reset_cpu_usage(Unit *u); -- cgit v1.2.3-54-g00ecf