Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/sys/kern Fix ASSERT(x == y | z). Interp...



details:   https://anonhg.NetBSD.org/src/rev/adc8143837e4
branches:  trunk
changeset: 337332:adc8143837e4
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 11 16:32:07 2015 +0000

description:
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.

diffstat:

 external/cddl/osnet/sys/kern/taskq.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 1434aa0d4ac7 -r adc8143837e4 external/cddl/osnet/sys/kern/taskq.c
--- a/external/cddl/osnet/sys/kern/taskq.c      Sat Apr 11 16:22:07 2015 +0000
+++ b/external/cddl/osnet/sys/kern/taskq.c      Sat Apr 11 16:32:07 2015 +0000
@@ -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 @@
        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 @@
        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';



Home | Main Index | Thread Index | Old Index