Module Name: src Committed By: riastradh Date: Sat Apr 11 16:32:07 UTC 2015
Modified Files: src/external/cddl/osnet/sys/kern: taskq.c Log Message: Fix ASSERT(x == y | z). Interpret nthreads as pct when requested. Reduces the number of threads created by zfs to a slightly less insane value. XXX This whole taskq business is questionable, and we really really should not have copies of external code outside dist/ and without vendor branches to record provenance and local changes. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sys/kern/taskq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/cddl/osnet/sys/kern/taskq.c diff -u src/external/cddl/osnet/sys/kern/taskq.c:1.4 src/external/cddl/osnet/sys/kern/taskq.c:1.5 --- src/external/cddl/osnet/sys/kern/taskq.c:1.4 Sat Apr 11 00:13:04 2015 +++ src/external/cddl/osnet/sys/kern/taskq.c Sat Apr 11 16:32:07 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: taskq.c,v 1.4 2015/04/11 00:13:04 riastradh Exp $ */ +/* $NetBSD: taskq.c,v 1.5 2015/04/11 16:32:07 riastradh Exp $ */ /* * CDDL HEADER START @@ -905,7 +905,8 @@ taskq_create_common(const char *name, in uint_t bsize; /* # of buckets - always power of 2 */ ASSERT(instance == 0); - ASSERT(flags == TASKQ_PREPOPULATE | TASKQ_NOINSTANCE); + ASSERT(!ISSET(flags, TASKQ_CPR_SAFE)); + ASSERT(!ISSET(flags, TASKQ_DYNAMIC)); /* * TASKQ_CPR_SAFE and TASKQ_DYNAMIC flags are mutually exclusive. @@ -919,7 +920,10 @@ taskq_create_common(const char *name, in ASSERT(bsize >= 1); bsize = MIN(bsize, taskq_maxbuckets); - tq->tq_maxsize = nthreads; + ASSERT(!(flags & TASKQ_DYNAMIC)); + if (flags & TASKQ_THREADS_CPU_PCT) + /* nthreads is % of CPUs we want to use. */ + nthreads = (ncpus*nthreads)/100; (void) strncpy(tq->tq_name, name, TASKQ_NAMELEN + 1); tq->tq_name[TASKQ_NAMELEN] = '\0';