From 31d3a520297980ac31186e27396a05f928fde49f Mon Sep 17 00:00:00 2001 From: Peter Morrow Date: Tue, 14 Sep 2021 17:14:53 +0100 Subject: [PATCH 1/3] 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 --- src/core/cgroup.c | 40 ++++++++++++++++++++++++--- src/core/cgroup.h | 2 ++ src/core/dbus-cgroup.c | 14 ++++++++-- src/core/load-fragment-gperf.gperf.in | 6 ++-- src/core/load-fragment.c | 26 ++--------------- src/core/load-fragment.h | 3 +- src/shared/bus-unit-util.c | 4 ++- 7 files changed, 60 insertions(+), 35 deletions(-) diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 2d136793f9..17e93d7af1 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -251,7 +251,9 @@ void cgroup_context_done(CGroupContext *c) { c->restrict_network_interfaces = set_free(c->restrict_network_interfaces); cpu_set_reset(&c->cpuset_cpus); + cpu_set_reset(&c->startup_cpuset_cpus); cpu_set_reset(&c->cpuset_mems); + cpu_set_reset(&c->startup_cpuset_mems); } static int unit_get_kernel_memory_limit(Unit *u, const char *file, uint64_t *ret) { @@ -386,7 +388,7 @@ static char *format_cgroup_memory_limit_comparison(char *buf, size_t l, Unit *u, } void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) { - _cleanup_free_ char *disable_controllers_str = NULL, *cpuset_cpus = NULL, *cpuset_mems = NULL; + _cleanup_free_ char *disable_controllers_str = NULL, *cpuset_cpus = NULL, *cpuset_mems = NULL, *startup_cpuset_cpus = NULL, *startup_cpuset_mems = NULL; CGroupIODeviceLimit *il; CGroupIODeviceWeight *iw; CGroupIODeviceLatency *l; @@ -415,7 +417,9 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) { (void) cg_mask_to_string(c->disable_controllers, &disable_controllers_str); cpuset_cpus = cpu_set_to_range_string(&c->cpuset_cpus); + startup_cpuset_cpus = cpu_set_to_range_string(&c->startup_cpuset_cpus); cpuset_mems = cpu_set_to_range_string(&c->cpuset_mems); + startup_cpuset_mems = cpu_set_to_range_string(&c->startup_cpuset_mems); fprintf(f, "%sCPUAccounting: %s\n" @@ -431,7 +435,9 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) { "%sCPUQuotaPerSecSec: %s\n" "%sCPUQuotaPeriodSec: %s\n" "%sAllowedCPUs: %s\n" + "%sStartupAllowedCPUs: %s\n" "%sAllowedMemoryNodes: %s\n" + "%sStartupAllowedMemoryNodes: %s\n" "%sIOWeight: %" PRIu64 "\n" "%sStartupIOWeight: %" PRIu64 "\n" "%sBlockIOWeight: %" PRIu64 "\n" @@ -465,7 +471,9 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) { prefix, FORMAT_TIMESPAN(c->cpu_quota_per_sec_usec, 1), prefix, FORMAT_TIMESPAN(c->cpu_quota_period_usec, 1), prefix, strempty(cpuset_cpus), + prefix, strempty(startup_cpuset_cpus), prefix, strempty(cpuset_mems), + prefix, strempty(startup_cpuset_mems), prefix, c->io_weight, prefix, c->startup_io_weight, prefix, c->blockio_weight, @@ -827,6 +835,14 @@ static bool cgroup_context_has_cpu_shares(CGroupContext *c) { c->startup_cpu_shares != CGROUP_CPU_SHARES_INVALID; } +static bool cgroup_context_has_allowed_cpus(CGroupContext *c) { + return c->cpuset_cpus.set || c->startup_cpuset_cpus.set; +} + +static bool cgroup_context_has_allowed_mems(CGroupContext *c) { + return c->cpuset_mems.set || c->startup_cpuset_mems.set; +} + static uint64_t cgroup_context_cpu_weight(CGroupContext *c, ManagerState state) { if (IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_cpu_weight != CGROUP_WEIGHT_INVALID) @@ -847,6 +863,22 @@ static uint64_t cgroup_context_cpu_shares(CGroupContext *c, ManagerState state) return CGROUP_CPU_SHARES_DEFAULT; } +static CPUSet *cgroup_context_allowed_cpus(CGroupContext *c, ManagerState state) { + if (IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && + c->startup_cpuset_cpus.set) + return &c->startup_cpuset_cpus; + else + return &c->cpuset_cpus; +} + +static CPUSet *cgroup_context_allowed_mems(CGroupContext *c, ManagerState state) { + if (IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && + c->startup_cpuset_mems.set) + return &c->startup_cpuset_mems; + else + return &c->cpuset_mems; +} + usec_t cgroup_cpu_adjust_period(usec_t period, usec_t quota, usec_t resolution, usec_t max_period) { /* kernel uses a minimum resolution of 1ms, so both period and (quota * period) * need to be higher than that boundary. quota is specified in USecPerSec. @@ -1302,8 +1334,8 @@ static void cgroup_context_apply( } if ((apply_mask & CGROUP_MASK_CPUSET) && !is_local_root) { - cgroup_apply_unified_cpuset(u, &c->cpuset_cpus, "cpuset.cpus"); - cgroup_apply_unified_cpuset(u, &c->cpuset_mems, "cpuset.mems"); + cgroup_apply_unified_cpuset(u, cgroup_context_allowed_cpus(c, state), "cpuset.cpus"); + cgroup_apply_unified_cpuset(u, cgroup_context_allowed_mems(c, state), "cpuset.mems"); } /* The 'io' controller attributes are not exported on the host's root cgroup (being a pure cgroup v2 @@ -1627,7 +1659,7 @@ static CGroupMask unit_get_cgroup_mask(Unit *u) { c->cpu_quota_per_sec_usec != USEC_INFINITY) mask |= CGROUP_MASK_CPU; - if (c->cpuset_cpus.set || c->cpuset_mems.set) + if (cgroup_context_has_allowed_cpus(c) || cgroup_context_has_allowed_mems(c)) mask |= CGROUP_MASK_CPUSET; if (cgroup_context_has_io_config(c) || cgroup_context_has_blockio_config(c)) diff --git a/src/core/cgroup.h b/src/core/cgroup.h index 9bb968b6c1..951ddda525 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -131,7 +131,9 @@ struct CGroupContext { usec_t cpu_quota_period_usec; CPUSet cpuset_cpus; + CPUSet startup_cpuset_cpus; CPUSet cpuset_mems; + CPUSet startup_cpuset_mems; uint64_t io_weight; uint64_t startup_io_weight; 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; diff --git a/src/core/load-fragment-gperf.gperf.in b/src/core/load-fragment-gperf.gperf.in index b3dc3bc0fc..17c43005bc 100644 --- a/src/core/load-fragment-gperf.gperf.in +++ b/src/core/load-fragment-gperf.gperf.in @@ -181,8 +181,10 @@ {%- macro CGROUP_CONTEXT_CONFIG_ITEMS(type) -%} {{type}}.Slice, config_parse_unit_slice, 0, 0 -{{type}}.AllowedCPUs, config_parse_allowed_cpus, 0, offsetof({{type}}, cgroup_context) -{{type}}.AllowedMemoryNodes, config_parse_allowed_mems, 0, offsetof({{type}}, cgroup_context) +{{type}}.AllowedCPUs, config_parse_allowed_cpuset, 0, offsetof({{type}}, cgroup_context.cpuset_cpus) +{{type}}.StartupAllowedCPUs, config_parse_allowed_cpuset, 0, offsetof({{type}}, cgroup_context.startup_cpuset_cpus) +{{type}}.AllowedMemoryNodes, config_parse_allowed_cpuset, 0, offsetof({{type}}, cgroup_context.cpuset_mems) +{{type}}.StartupAllowedMemoryNodes, config_parse_allowed_cpuset, 0, offsetof({{type}}, cgroup_context.startup_cpuset_mems) {{type}}.CPUAccounting, config_parse_bool, 0, offsetof({{type}}, cgroup_context.cpu_accounting) {{type}}.CPUWeight, config_parse_cg_weight, 0, offsetof({{type}}, cgroup_context.cpu_weight) {{type}}.StartupCPUWeight, config_parse_cg_weight, 0, offsetof({{type}}, cgroup_context.startup_cpu_weight) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 1c8159a235..220f11f825 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3616,7 +3616,7 @@ int config_parse_cpu_quota( return 0; } -int config_parse_allowed_cpus( +int config_parse_allowed_cpuset( const char *unit, const char *filename, unsigned line, @@ -3628,29 +3628,9 @@ int config_parse_allowed_cpus( void *data, void *userdata) { - CGroupContext *c = data; - - (void) parse_cpu_set_extend(rvalue, &c->cpuset_cpus, true, unit, filename, line, lvalue); - - return 0; -} - -int config_parse_allowed_mems( - const char *unit, - const char *filename, - unsigned line, - const char *section, - unsigned section_line, - const char *lvalue, - int ltype, - const char *rvalue, - void *data, - void *userdata) { - - CGroupContext *c = data; - - (void) parse_cpu_set_extend(rvalue, &c->cpuset_mems, true, unit, filename, line, lvalue); + CPUSet *c = data; + (void) parse_cpu_set_extend(rvalue, c, true, unit, filename, line, lvalue); return 0; } diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h index fe98091ee4..0d8863aa63 100644 --- a/src/core/load-fragment.h +++ b/src/core/load-fragment.h @@ -101,8 +101,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_set_status); CONFIG_PARSER_PROTOTYPE(config_parse_namespace_path_strv); CONFIG_PARSER_PROTOTYPE(config_parse_temporary_filesystems); CONFIG_PARSER_PROTOTYPE(config_parse_cpu_quota); -CONFIG_PARSER_PROTOTYPE(config_parse_allowed_cpus); -CONFIG_PARSER_PROTOTYPE(config_parse_allowed_mems); +CONFIG_PARSER_PROTOTYPE(config_parse_allowed_cpuset); CONFIG_PARSER_PROTOTYPE(config_parse_protect_home); CONFIG_PARSER_PROTOTYPE(config_parse_protect_system); CONFIG_PARSER_PROTOTYPE(config_parse_bus_name); diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 669d0df058..f9637ac0cc 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -474,7 +474,9 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons return bus_append_cg_cpu_shares_parse(m, field, eq); if (STR_IN_SET(field, "AllowedCPUs", - "AllowedMemoryNodes")) { + "StartupAllowedCPUs", + "AllowedMemoryNodes", + "StartupAllowedMemoryNodes")) { _cleanup_(cpu_set_reset) CPUSet cpuset = {}; _cleanup_free_ uint8_t *array = NULL; size_t allocated; From c93a7d4ad303210541634ee95c78d186b27e1118 Mon Sep 17 00:00:00 2001 From: Peter Morrow Date: Tue, 14 Sep 2021 17:28:46 +0100 Subject: [PATCH 2/3] docs: update docs with StartupAllowedCPUs and StartupAllowedMemoryNodes details Signed-off-by: Peter Morrow --- docs/TRANSIENT-SETTINGS.md | 2 + man/org.freedesktop.systemd1.xml | 72 ++++++++++++++++++++++++++++++++ man/systemd.resource-control.xml | 23 +++++++--- 3 files changed, 92 insertions(+), 5 deletions(-) diff --git a/docs/TRANSIENT-SETTINGS.md b/docs/TRANSIENT-SETTINGS.md index 3a75627ca9..77dff10bee 100644 --- a/docs/TRANSIENT-SETTINGS.md +++ b/docs/TRANSIENT-SETTINGS.md @@ -238,7 +238,9 @@ All cgroup/resource control settings are available for transient units ✓ CPUQuota= ✓ CPUQuotaPeriodSec= ✓ AllowedCPUs= +✓ StartupAllowedCPUs= ✓ AllowedMemoryNodes= +✓ StartupAllowedMemoryNodes= ✓ MemoryAccounting= ✓ DefaultMemoryMin= ✓ MemoryMin= diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml index 09cb233553..d063d6d4d9 100644 --- a/man/org.freedesktop.systemd1.xml +++ b/man/org.freedesktop.systemd1.xml @@ -2445,8 +2445,12 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedCPUs = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedCPUs = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedMemoryNodes = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedMemoryNodes = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly b IOAccounting = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly t IOWeight = ...; @@ -2988,8 +2992,12 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { + + + + @@ -3558,8 +3566,12 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { + + + + @@ -4263,8 +4275,12 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedCPUs = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedCPUs = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedMemoryNodes = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedMemoryNodes = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly b IOAccounting = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly t IOWeight = ...; @@ -4834,8 +4850,12 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { + + + + @@ -5402,8 +5422,12 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { + + + + @@ -6004,8 +6028,12 @@ node /org/freedesktop/systemd1/unit/home_2emount { @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedCPUs = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedCPUs = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedMemoryNodes = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedMemoryNodes = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly b IOAccounting = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly t IOWeight = ...; @@ -6503,8 +6531,12 @@ node /org/freedesktop/systemd1/unit/home_2emount { + + + + @@ -6989,8 +7021,12 @@ node /org/freedesktop/systemd1/unit/home_2emount { + + + + @@ -7712,8 +7748,12 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedCPUs = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedCPUs = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedMemoryNodes = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedMemoryNodes = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly b IOAccounting = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly t IOWeight = ...; @@ -8197,8 +8237,12 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { + + + + @@ -8669,8 +8713,12 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { + + + + @@ -9245,8 +9293,12 @@ node /org/freedesktop/systemd1/unit/system_2eslice { @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedCPUs = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedCPUs = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedMemoryNodes = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedMemoryNodes = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly b IOAccounting = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly t IOWeight = ...; @@ -9390,8 +9442,12 @@ node /org/freedesktop/systemd1/unit/system_2eslice { + + + + @@ -9542,8 +9598,12 @@ node /org/freedesktop/systemd1/unit/system_2eslice { + + + + @@ -9714,8 +9774,12 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope { @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedCPUs = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedCPUs = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly ay AllowedMemoryNodes = [...]; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") + readonly ay StartupAllowedMemoryNodes = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly b IOAccounting = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly t IOWeight = ...; @@ -9875,8 +9939,12 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope { + + + + @@ -10053,8 +10121,12 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope { + + + + diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml index a8c8fad9ef..ea728dff33 100644 --- a/man/systemd.resource-control.xml +++ b/man/systemd.resource-control.xml @@ -237,13 +237,20 @@ AllowedCPUs= + StartupAllowedCPUs= Restrict processes to be executed on specific CPUs. Takes a list of CPU indices or ranges separated by either whitespace or commas. CPU ranges are specified by the lower and upper CPU indices separated by a dash. - Setting AllowedCPUs= doesn't guarantee that all of the CPUs will be used by the processes - as it may be limited by parent units. The effective configuration is reported as EffectiveCPUs=. + Setting AllowedCPUs= or StartupAllowedCPUs= doesn't guarantee that all + of the CPUs will be used by the processes as it may be limited by parent units. The effective configuration is + reported as EffectiveCPUs=. + + While StartupAllowedCPUs= only applies to the startup phase of the system, + AllowedCPUs= applies to normal runtime of the system, and if the former is not set also to + the startup phase. Using StartupAllowedCPUs= allows prioritizing specific services at + boot-up differently than during normal runtime. This setting is supported only with the unified control group hierarchy. @@ -251,15 +258,21 @@ AllowedMemoryNodes= + StartupAllowedMemoryNodes= Restrict processes to be executed on specific memory NUMA nodes. Takes a list of memory NUMA nodes indices or ranges separated by either whitespace or commas. Memory NUMA nodes ranges are specified by the lower and upper NUMA nodes indices separated by a dash. - Setting AllowedMemoryNodes= doesn't guarantee that all of the memory NUMA nodes will - be used by the processes as it may be limited by parent units. The effective configuration is reported as - EffectiveMemoryNodes=. + Setting AllowedMemoryNodes= or StartupAllowedMemoryNodes= doesn't + guarantee that all of the memory NUMA nodes will be used by the processes as it may be limited by parent units. + The effective configuration is reported as EffectiveMemoryNodes=. + + While StartupAllowedMemoryNodes= only applies to the startup phase of the system, + AllowedMemoryNodes= applies to normal runtime of the system, and if the former is not set also to + the startup phase. Using StartupAllowedMemoryNodes= allows prioritizing specific services at + boot-up differently than during normal runtime. This setting is supported only with the unified control group hierarchy. From 88a56dc8d64b667ce30a922fc3b6d8cdddd3a460 Mon Sep 17 00:00:00 2001 From: Peter Morrow Date: Tue, 14 Sep 2021 19:31:07 +0100 Subject: [PATCH 3/3] fuzz: add StartupAllowedCPUs and StartupAllowedMemoryNodes to directives Signed-off-by: Peter Morrow --- test/fuzz/fuzz-unit-file/directives.mount | 2 ++ test/fuzz/fuzz-unit-file/directives.scope | 2 ++ test/fuzz/fuzz-unit-file/directives.service | 2 ++ test/fuzz/fuzz-unit-file/directives.slice | 2 ++ test/fuzz/fuzz-unit-file/directives.socket | 2 ++ test/fuzz/fuzz-unit-file/directives.swap | 2 ++ 6 files changed, 12 insertions(+) diff --git a/test/fuzz/fuzz-unit-file/directives.mount b/test/fuzz/fuzz-unit-file/directives.mount index fd82fc5348..da33c99de3 100644 --- a/test/fuzz/fuzz-unit-file/directives.mount +++ b/test/fuzz/fuzz-unit-file/directives.mount @@ -1,7 +1,9 @@ mount [Mount] AllowedCPUs= +StartupAllowedCPUs= AllowedMemoryNodes= +StartupAllowedMemoryNodes= AmbientCapabilities= AppArmorProfile= BPFProgram= diff --git a/test/fuzz/fuzz-unit-file/directives.scope b/test/fuzz/fuzz-unit-file/directives.scope index ab49083311..d8ea9fcfb5 100644 --- a/test/fuzz/fuzz-unit-file/directives.scope +++ b/test/fuzz/fuzz-unit-file/directives.scope @@ -1,7 +1,9 @@ scope [Scope] AllowedCPUs= +StartupAllowedCPUs= AllowedMemoryNodes= +StartupAllowedMemoryNodes= BPFProgram= BlockIOAccounting= BlockIODeviceWeight= diff --git a/test/fuzz/fuzz-unit-file/directives.service b/test/fuzz/fuzz-unit-file/directives.service index 6a80bbcb2f..7318c5f9d6 100644 --- a/test/fuzz/fuzz-unit-file/directives.service +++ b/test/fuzz/fuzz-unit-file/directives.service @@ -115,7 +115,9 @@ RequiredBy= WantedBy= [Service] AllowedCPUs= +StartupAllowedCPUs= AllowedMemoryNodes= +StartupAllowedMemoryNodes= AmbientCapabilities= AppArmorProfile= BindPaths= diff --git a/test/fuzz/fuzz-unit-file/directives.slice b/test/fuzz/fuzz-unit-file/directives.slice index 17bd431db7..1a20987698 100644 --- a/test/fuzz/fuzz-unit-file/directives.slice +++ b/test/fuzz/fuzz-unit-file/directives.slice @@ -1,7 +1,9 @@ slice [Slice] AllowedCPUs= +StartupAllowedCPUs= AllowedMemoryNodes= +StartupAllowedMemoryNodes= BPFProgram= BlockIOAccounting= BlockIODeviceWeight= diff --git a/test/fuzz/fuzz-unit-file/directives.socket b/test/fuzz/fuzz-unit-file/directives.socket index 1a79a0dfd1..02b909f00d 100644 --- a/test/fuzz/fuzz-unit-file/directives.socket +++ b/test/fuzz/fuzz-unit-file/directives.socket @@ -2,7 +2,9 @@ socket [Socket] Accept= AllowedCPUs= +StartupAllowedCPUs= AllowedMemoryNodes= +StartupAllowedMemoryNodes= AmbientCapabilities= AppArmorProfile= BPFProgram= diff --git a/test/fuzz/fuzz-unit-file/directives.swap b/test/fuzz/fuzz-unit-file/directives.swap index 204e172514..b7598fdf06 100644 --- a/test/fuzz/fuzz-unit-file/directives.swap +++ b/test/fuzz/fuzz-unit-file/directives.swap @@ -1,7 +1,9 @@ swap [Swap] AllowedCPUs= +StartupAllowedCPUs= AllowedMemoryNodes= +StartupAllowedMemoryNodes= AmbientCapabilities= AppArmorProfile= BPFProgram=