summaryrefslogtreecommitdiffstats
path: root/usr.bin/numactl
diff options
context:
space:
mode:
authorvangyzen <vangyzen@FreeBSD.org>2016-01-14 01:34:41 +0000
committervangyzen <vangyzen@FreeBSD.org>2016-01-14 01:34:41 +0000
commitfeef239c36a04fb4f7a87e2238eedf45634c9552 (patch)
tree69fbbc2426db8ff186b48dc453373372f0662259 /usr.bin/numactl
parent3ffa9342143fe71b14d68a35fe3eae4ff1be3f8e (diff)
downloadFreeBSD-src-feef239c36a04fb4f7a87e2238eedf45634c9552.zip
FreeBSD-src-feef239c36a04fb4f7a87e2238eedf45634c9552.tar.gz
numactl: fix CPU affinity when modifying an existing process or thread
numactl was only modifying its own CPU affinity, which is fine when creating a new process, but not very helpful when modifying an existing processes. Reviewed by: adrian Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D4927
Diffstat (limited to 'usr.bin/numactl')
-rw-r--r--usr.bin/numactl/numactl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/numactl/numactl.c b/usr.bin/numactl/numactl.c
index ce1dfae..8ad0d007 100644
--- a/usr.bin/numactl/numactl.c
+++ b/usr.bin/numactl/numactl.c
@@ -133,7 +133,7 @@ usage(void)
}
static int
-set_numa_domain_cpuaffinity(int cpu_domain)
+set_numa_domain_cpuaffinity(int cpu_domain, cpuwhich_t which, id_t id)
{
cpuset_t set;
int error;
@@ -142,8 +142,8 @@ set_numa_domain_cpuaffinity(int cpu_domain)
cpu_domain, sizeof(set), &set);
if (error != 0)
err(1, "cpuset_getaffinity");
- error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
- sizeof(set), &set);
+ error = cpuset_setaffinity(CPU_LEVEL_WHICH, which, id, sizeof(set),
+ &set);
if (error != 0)
err(1, "cpuset_setaffinity");
@@ -228,7 +228,8 @@ main(int argc, char *argv[])
/* If a CPU domain policy was given, include that too */
if (cpu_domain != -1)
- (void) set_numa_domain_cpuaffinity(cpu_domain);
+ (void) set_numa_domain_cpuaffinity(cpu_domain,
+ CPU_WHICH_PID, -1);
errno = 0;
execvp(*argv, argv);
@@ -278,7 +279,7 @@ main(int argc, char *argv[])
/* If a CPU domain policy was given, include that too */
if (cpu_domain != -1)
- (void) set_numa_domain_cpuaffinity(cpu_domain);
+ (void) set_numa_domain_cpuaffinity(cpu_domain, which, id);
exit(0);
}
OpenPOWER on IntegriCloud