taskq.c (208047) | taskq.c (209962) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* |
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
23 * Use is subject to license terms. 24 */ 25 26#include <sys/zfs_context.h> 27 28int taskq_now; 29taskq_t *system_taskq; 30 --- 138 unchanged lines hidden (view full) --- 169/*ARGSUSED*/ 170taskq_t * 171taskq_create(const char *name, int nthreads, pri_t pri, 172 int minalloc, int maxalloc, uint_t flags) 173{ 174 taskq_t *tq = kmem_zalloc(sizeof (taskq_t), KM_SLEEP); 175 int t; 176 | 23 * Use is subject to license terms. 24 */ 25 26#include <sys/zfs_context.h> 27 28int taskq_now; 29taskq_t *system_taskq; 30 --- 138 unchanged lines hidden (view full) --- 169/*ARGSUSED*/ 170taskq_t * 171taskq_create(const char *name, int nthreads, pri_t pri, 172 int minalloc, int maxalloc, uint_t flags) 173{ 174 taskq_t *tq = kmem_zalloc(sizeof (taskq_t), KM_SLEEP); 175 int t; 176 |
177 if (flags & TASKQ_THREADS_CPU_PCT) { 178 int pct; 179 ASSERT3S(nthreads, >=, 0); 180 ASSERT3S(nthreads, <=, 100); 181 pct = MIN(nthreads, 100); 182 pct = MAX(pct, 0); 183 184 nthreads = (sysconf(_SC_NPROCESSORS_ONLN) * pct) / 100; 185 nthreads = MAX(nthreads, 1); /* need at least 1 thread */ 186 } else { 187 ASSERT3S(nthreads, >=, 1); 188 } 189 |
|
177 rw_init(&tq->tq_threadlock, NULL, RW_DEFAULT, NULL); 178 mutex_init(&tq->tq_lock, NULL, MUTEX_DEFAULT, NULL); 179 cv_init(&tq->tq_dispatch_cv, NULL, CV_DEFAULT, NULL); 180 cv_init(&tq->tq_wait_cv, NULL, CV_DEFAULT, NULL); 181 tq->tq_flags = flags | TASKQ_ACTIVE; 182 tq->tq_active = nthreads; 183 tq->tq_nthreads = nthreads; 184 tq->tq_minalloc = minalloc; --- 77 unchanged lines hidden --- | 190 rw_init(&tq->tq_threadlock, NULL, RW_DEFAULT, NULL); 191 mutex_init(&tq->tq_lock, NULL, MUTEX_DEFAULT, NULL); 192 cv_init(&tq->tq_dispatch_cv, NULL, CV_DEFAULT, NULL); 193 cv_init(&tq->tq_wait_cv, NULL, CV_DEFAULT, NULL); 194 tq->tq_flags = flags | TASKQ_ACTIVE; 195 tq->tq_active = nthreads; 196 tq->tq_nthreads = nthreads; 197 tq->tq_minalloc = minalloc; --- 77 unchanged lines hidden --- |