summaryrefslogtreecommitdiffstats
path: root/src/core/dbus-cgroup.c
diff options
context:
space:
mode:
authorPeter Morrow <pemorrow@linux.microsoft.com>2021-09-14 18:14:53 +0200
committerPeter Morrow <pemorrow@linux.microsoft.com>2021-09-15 10:30:12 +0200
commit31d3a520297980ac31186e27396a05f928fde49f (patch)
treeb51a6ceddd6847ffddd7f49a0510a119cdd660c4 /src/core/dbus-cgroup.c
parentpo: Translated using Weblate (Finnish) (diff)
downloadsystemd-31d3a520297980ac31186e27396a05f928fde49f.tar.xz
systemd-31d3a520297980ac31186e27396a05f928fde49f.zip
cgroup: add support for StartupAllowedCPUs and StartupAllowedMemoryNodes
Add new settings which can be used to control cpuset based cpu affinity during the startup phase only. Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
Diffstat (limited to 'src/core/dbus-cgroup.c')
-rw-r--r--src/core/dbus-cgroup.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
index ef7d529de9..f0d8759e85 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -461,7 +461,9 @@ const sd_bus_vtable bus_cgroup_vtable[] = {
SD_BUS_PROPERTY("CPUQuotaPerSecUSec", "t", bus_property_get_usec, offsetof(CGroupContext, cpu_quota_per_sec_usec), 0),
SD_BUS_PROPERTY("CPUQuotaPeriodUSec", "t", bus_property_get_usec, offsetof(CGroupContext, cpu_quota_period_usec), 0),
SD_BUS_PROPERTY("AllowedCPUs", "ay", property_get_cpuset, offsetof(CGroupContext, cpuset_cpus), 0),
+ SD_BUS_PROPERTY("StartupAllowedCPUs", "ay", property_get_cpuset, offsetof(CGroupContext, startup_cpuset_cpus), 0),
SD_BUS_PROPERTY("AllowedMemoryNodes", "ay", property_get_cpuset, offsetof(CGroupContext, cpuset_mems), 0),
+ SD_BUS_PROPERTY("StartupAllowedMemoryNodes", "ay", property_get_cpuset, offsetof(CGroupContext, startup_cpuset_mems), 0),
SD_BUS_PROPERTY("IOAccounting", "b", bus_property_get_bool, offsetof(CGroupContext, io_accounting), 0),
SD_BUS_PROPERTY("IOWeight", "t", NULL, offsetof(CGroupContext, io_weight), 0),
SD_BUS_PROPERTY("StartupIOWeight", "t", NULL, offsetof(CGroupContext, startup_io_weight), 0),
@@ -1169,7 +1171,7 @@ int bus_cgroup_set_property(
return 1;
- } else if (STR_IN_SET(name, "AllowedCPUs", "AllowedMemoryNodes")) {
+ } else if (STR_IN_SET(name, "AllowedCPUs", "StartupAllowedCPUs", "AllowedMemoryNodes", "StartupAllowedMemoryNodes")) {
const void *a;
size_t n;
_cleanup_(cpu_set_reset) CPUSet new_set = {};
@@ -1184,7 +1186,7 @@ int bus_cgroup_set_property(
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
_cleanup_free_ char *setstr = NULL;
- CPUSet *set;
+ CPUSet *set = NULL;
setstr = cpu_set_to_range_string(&new_set);
if (!setstr)
@@ -1192,8 +1194,14 @@ int bus_cgroup_set_property(
if (streq(name, "AllowedCPUs"))
set = &c->cpuset_cpus;
- else
+ else if (streq(name, "StartupAllowedCPUs"))
+ set = &c->startup_cpuset_cpus;
+ else if (streq(name, "AllowedMemoryNodes"))
set = &c->cpuset_mems;
+ else if (streq(name, "StartupAllowedMemoryNodes"))
+ set = &c->startup_cpuset_mems;
+
+ assert(set);
cpu_set_reset(set);
*set = new_set;