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:
@@ -29,6 +29,7 @@
|
||||
#include "signal-util.h"
|
||||
#include "socket-util.h"
|
||||
#include "sort-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
#include "syslog-util.h"
|
||||
#include "terminal-util.h"
|
||||
@@ -1103,6 +1104,13 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
|
||||
_cleanup_free_ uint8_t *array = NULL;
|
||||
size_t allocated;
|
||||
|
||||
if (eq && streq(eq, "numa")) {
|
||||
r = sd_bus_message_append(m, "(sv)", "CPUAffinityFromNUMA", "b", true);
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = parse_cpu_set(eq, &cpuset);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to parse %s value: %s", field, eq);
|
||||
|
||||
@@ -131,7 +131,7 @@ int cpu_set_add_all(CPUSet *a, const CPUSet *b) {
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int parse_cpu_set_full(
|
||||
@@ -216,7 +216,7 @@ int parse_cpu_set_extend(
|
||||
if (!old->set) {
|
||||
*old = cpuset;
|
||||
cpuset = (CPUSet) {};
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return cpu_set_add_all(old, &cpuset);
|
||||
|
||||
Reference in New Issue
Block a user