There is no reason that the main thread should be treated differently, so apply the affinity setting there too. Signed-off-by: John Kacur <jkacur@xxxxxxxxxx> --- src/cyclictest/cyclictest.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 13d2b1722890..f8df4c6954ad 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -1992,6 +1992,17 @@ int main(int argc, char **argv) if (verbose) printf("Max CPUs = %d\n", max_cpus); + /* Restrict the main pid to the affinity specified by the user */ + if (affinity_mask != NULL) { + int res; + + errno = 0; + res = numa_sched_setaffinity(getpid(), affinity_mask); + if (res != 0) { + warn("Couldn't setaffinity in main thread: %s\n", strerror(errno)); + } + } + if (trigger) { int retval; retval = trigger_init(); -- 2.20.1