core: add support for setting CPUAffinity= to special "numa" value

systemd will automatically derive CPU affinity mask from NUMA node
mask.

Fixes #13248
This commit is contained in:
Michal Sekletár
2020-03-16 08:57:28 +01:00
parent 1808f76870
commit e2b2fb7f56
9 changed files with 125 additions and 13 deletions
+3 -3
View File
@@ -216,12 +216,12 @@ static void test_parse_cpu_set_extend(void) {
log_info("/* %s */", __func__);
assert_se(parse_cpu_set_extend("1 3", &c, true, NULL, "fake", 1, "CPUAffinity") == 0);
assert_se(parse_cpu_set_extend("1 3", &c, true, NULL, "fake", 1, "CPUAffinity") == 1);
assert_se(CPU_COUNT_S(c.allocated, c.set) == 2);
assert_se(s1 = cpu_set_to_string(&c));
log_info("cpu_set_to_string: %s", s1);
assert_se(parse_cpu_set_extend("4", &c, true, NULL, "fake", 1, "CPUAffinity") == 0);
assert_se(parse_cpu_set_extend("4", &c, true, NULL, "fake", 1, "CPUAffinity") == 1);
assert_se(CPU_COUNT_S(c.allocated, c.set) == 3);
assert_se(s2 = cpu_set_to_string(&c));
log_info("cpu_set_to_string: %s", s2);
@@ -238,7 +238,7 @@ static void test_cpu_set_to_from_dbus(void) {
log_info("/* %s */", __func__);
assert_se(parse_cpu_set_extend("1 3 8 100-200", &c, true, NULL, "fake", 1, "CPUAffinity") == 0);
assert_se(parse_cpu_set_extend("1 3 8 100-200", &c, true, NULL, "fake", 1, "CPUAffinity") == 1);
assert_se(s = cpu_set_to_string(&c));
log_info("cpu_set_to_string: %s", s);
assert_se(CPU_COUNT_S(c.allocated, c.set) == 104);