From owner-svn-src-head@freebsd.org Sat Sep 3 00:22:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03314BCE324; Sat, 3 Sep 2016 00:22:44 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4DAD849; Sat, 3 Sep 2016 00:22:43 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u830Mgos078389; Sat, 3 Sep 2016 00:22:42 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u830MgPs078388; Sat, 3 Sep 2016 00:22:42 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201609030022.u830MgPs078388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Sat, 3 Sep 2016 00:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305312 - head/tools/tools/crypto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2016 00:22:44 -0000 Author: gnn Date: Sat Sep 3 00:22:42 2016 New Revision: 305312 URL: https://svnweb.freebsd.org/changeset/base/305312 Log: Add cpuset support to separate forked processes. Reviewed by: cem Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D7766 Modified: head/tools/tools/crypto/cryptotest.c Modified: head/tools/tools/crypto/cryptotest.c ============================================================================== --- head/tools/tools/crypto/cryptotest.c Fri Sep 2 22:47:57 2016 (r305311) +++ head/tools/tools/crypto/cryptotest.c Sat Sep 3 00:22:42 2016 (r305312) @@ -97,6 +97,7 @@ #include #include #include +#include #include #include @@ -468,6 +469,11 @@ runtests(struct alg *alg, int count, int 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;