summaryrefslogtreecommitdiff
path: root/src/core/cgroup.h
diff options
context:
space:
mode:
authorPavel Hrdina <phrdina@redhat.com>2019-07-29 17:50:05 +0200
committerPavel Hrdina <phrdina@redhat.com>2019-09-24 15:16:07 +0200
commit047f5d63d7a1ab75073f8485e2f9b550d25b0772 (patch)
tree1d0050d1a22e2b9fda999b0e7b3fad2b13a1709d /src/core/cgroup.h
parent68c2b5ddb1881c40201c1d86a7852dd5c5c06a76 (diff)
downloadsystemd-047f5d63d7a1ab75073f8485e2f9b550d25b0772.tar.gz
cgroup: introduce support for cgroup v2 CPUSET controller
Introduce support for configuring cpus and mems for processes using cgroup v2 CPUSET controller. This allows users to limit which cpus and memory NUMA nodes can be used by processes to better utilize system resources. The cgroup v2 interfaces to control it are cpuset.cpus and cpuset.mems where the requested configuration is written. However, it doesn't mean that the requested configuration will be actually used as parent cgroup may limit the cpus or mems as well. In order to reflect the real configuration cgroup v2 provides read-only files cpuset.cpus.effective and cpuset.mems.effective which are exported to users as well.
Diffstat (limited to 'src/core/cgroup.h')
-rw-r--r--src/core/cgroup.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index d8ec070623..bca53fb980 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include "cgroup-util.h"
+#include "cpu-set-util.h"
#include "ip-address-access.h"
#include "list.h"
#include "time-util.h"
@@ -92,6 +93,9 @@ struct CGroupContext {
usec_t cpu_quota_per_sec_usec;
usec_t cpu_quota_period_usec;
+ CPUSet cpuset_cpus;
+ CPUSet cpuset_mems;
+
uint64_t io_weight;
uint64_t startup_io_weight;
LIST_HEAD(CGroupIODeviceWeight, io_device_weights);
@@ -254,3 +258,5 @@ CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_;
bool unit_cgroup_delegate(Unit *u);
int compare_job_priority(const void *a, const void *b);
+
+int unit_get_cpuset(Unit *u, CPUSet *cpus, const char *name);