Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Apr 2010 09:03:37 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206838 - head/sys/cddl/compat/opensolaris/kern
Message-ID:  <201004190903.o3J93b5R053308@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Apr 19 09:03:36 2010
New Revision: 206838
URL: http://svn.freebsd.org/changeset/base/206838

Log:
  Partially MFp4 #176265 by pjd@:
  
   - Properly initialize and destroy system_taskq.
   - Add a dummy implementation of taskq_create_proc().
  
  Note: We do not currently use system_taskq in ZFS so this is mostly a
  no-op at this time.  Proper system_taskq initialization is required
  by newer ZFS code.
  
  Ok'ed by:	pjd
  MFC after:	2 weeks

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c	Mon Apr 19 09:03:34 2010	(r206837)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c	Mon Apr 19 09:03:36 2010	(r206838)
@@ -52,9 +52,9 @@ static void
 system_taskq_init(void *arg)
 {
 
-	system_taskq = (taskq_t *)taskqueue_thread;
 	taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask),
 	    NULL, NULL, NULL, NULL, 0, 0);
+	system_taskq = taskq_create("system_taskq", mp_ncpus, 0, 0, 0, 0);
 }
 SYSINIT(system_taskq_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_init, NULL);
 
@@ -62,6 +62,7 @@ static void
 system_taskq_fini(void *arg)
 {
 
+	taskq_destroy(system_taskq);
 	uma_zdestroy(taskq_zone);
 }
 SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, NULL);
@@ -72,10 +73,8 @@ taskq_create(const char *name, int nthre
 {
 	taskq_t *tq;
 
-	if ((flags & TASKQ_THREADS_CPU_PCT) != 0) {
-		/* TODO: Calculate number od threads. */
-		printf("%s: TASKQ_THREADS_CPU_PCT\n", __func__);
-	}
+	if ((flags & TASKQ_THREADS_CPU_PCT) != 0)
+		nthreads = MAX((mp_ncpus * nthreads) / 100, 1);
 
 	tq = kmem_alloc(sizeof(*tq), KM_SLEEP);
 	tq->tq_queue = taskqueue_create(name, M_WAITOK, taskqueue_thread_enqueue,
@@ -85,6 +84,14 @@ taskq_create(const char *name, int nthre
 	return ((taskq_t *)tq);
 }
 
+taskq_t *
+taskq_create_proc(const char *name, int nthreads, pri_t pri, int minalloc,
+    int maxalloc, proc_t *proc __unused, uint_t flags)
+{
+
+	return (taskq_create(name, nthreads, pri, minalloc, maxalloc, flags));
+}
+
 void
 taskq_destroy(taskq_t *tq)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004190903.o3J93b5R053308>