summaryrefslogtreecommitdiffstats
path: root/sys/cddl/compat/opensolaris/kern
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2010-05-16 15:12:34 +0000
committerpjd <pjd@FreeBSD.org>2010-05-16 15:12:34 +0000
commiteb30e42c89aa7f37d121daa051efdbc6ff771d97 (patch)
tree4cecc1f68a586e3e390b72a4ea5f321808f3da89 /sys/cddl/compat/opensolaris/kern
parent1c6b0503afe0e0b9a8b7f5fadbf8395db2dd37aa (diff)
downloadFreeBSD-src-eb30e42c89aa7f37d121daa051efdbc6ff771d97.zip
FreeBSD-src-eb30e42c89aa7f37d121daa051efdbc6ff771d97.tar.gz
Add task structure to zio and use it instead of allocating one.
This eliminates the only place where we can sleep when calling zio_interrupt(). As a side-effect this can actually improve performance a little as we allocate one less thing for every I/O. Prodded by: kib MFC after: 1 week
Diffstat (limited to 'sys/cddl/compat/opensolaris/kern')
-rw-r--r--sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c b/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
index 1e3b1ef..29bcd31 100644
--- a/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
+++ b/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
@@ -40,12 +40,6 @@ __FBSDID("$FreeBSD$");
static uma_zone_t taskq_zone;
-struct ostask {
- struct task ost_task;
- task_func_t *ost_func;
- void *ost_arg;
-};
-
taskq_t *system_taskq = NULL;
static void
@@ -140,3 +134,32 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
return ((taskqid_t)(void *)task);
}
+
+#define TASKQ_MAGIC 0x74541c
+
+static void
+taskq_run_safe(void *arg, int pending __unused)
+{
+ struct ostask *task = arg;
+
+ ASSERT(task->ost_magic == TASKQ_MAGIC);
+ task->ost_func(task->ost_arg);
+ task->ost_magic = 0;
+}
+
+taskqid_t
+taskq_dispatch_safe(taskq_t *tq, task_func_t func, void *arg,
+ struct ostask *task)
+{
+
+ ASSERT(task->ost_magic != TASKQ_MAGIC);
+
+ task->ost_magic = TASKQ_MAGIC;
+ task->ost_func = func;
+ task->ost_arg = arg;
+
+ TASK_INIT(&task->ost_task, 0, taskq_run_safe, task);
+ taskqueue_enqueue(tq->tq_queue, &task->ost_task);
+
+ return ((taskqid_t)(void *)task);
+}
OpenPOWER on IntegriCloud