1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

Add cpuset support to separate forked processes.

Reviewed by:	cem
Sponsored by:	Rubicon Communications, LLC (Netgate)
Differential Revision:	https://reviews.freebsd.org/D7766
This commit is contained in:
George V. Neville-Neil 2016-09-03 00:22:42 +00:00
parent 224d0bee95
commit 6e988609cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305312

View File

@ -97,6 +97,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#include <crypto/cryptodev.h>
@ -468,6 +469,11 @@ runtests(struct alg *alg, int count, int size, u_long cmd, int threads, int prof
if (threads > 1) {
for (i = 0; i < threads; i++)
if (fork() == 0) {
cpuset_t mask;
CPU_ZERO(&mask);
CPU_SET(i, &mask);
cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID,
-1, sizeof(mask), &mask);
runtest(alg, count, size, cmd, &tvp[i]);
exit(0);
}
@ -573,6 +579,9 @@ main(int argc, char **argv)
}
argc--, argv++;
}
if (maxthreads > CPU_SETSIZE)
errx(EX_USAGE, "Too many threads, %d, choose fewer.", maxthreads);
if (nsizes == 0) {
if (alg)
sizes[nsizes++] = alg->blocksize;