Lines Matching defs:tqe

716  * Append `tqe' in the end of the doubly-linked list denoted by l.
718 #define TQ_APPEND(l, tqe) { \
719 tqe->tqent_next = &l; \
720 tqe->tqent_prev = l.tqent_prev; \
721 tqe->tqent_next->tqent_prev = tqe; \
722 tqe->tqent_prev->tqent_next = tqe; \
725 * Prepend 'tqe' to the beginning of l
727 #define TQ_PREPEND(l, tqe) { \
728 tqe->tqent_next = l.tqent_next; \
729 tqe->tqent_prev = &l; \
730 tqe->tqent_next->tqent_prev = tqe; \
731 tqe->tqent_prev->tqent_next = tqe; \
735 * Schedule a task specified by func and arg into the task queue entry tqe.
737 #define TQ_DO_ENQUEUE(tq, tqe, func, arg, front) { \
741 TQ_PREPEND(tq->tq_task, tqe); \
743 TQ_APPEND(tq->tq_task, tqe); \
745 tqe->tqent_func = (func); \
746 tqe->tqent_arg = (arg); \
751 DTRACE_PROBE2(taskq__enqueue, taskq_t *, tq, taskq_ent_t *, tqe); \
754 #define TQ_ENQUEUE(tq, tqe, func, arg) \
755 TQ_DO_ENQUEUE(tq, tqe, func, arg, 0)
757 #define TQ_ENQUEUE_FRONT(tq, tqe, func, arg) \
758 TQ_DO_ENQUEUE(tq, tqe, func, arg, 1)
813 taskq_ent_t *tqe = buf;
815 tqe->tqent_thread = NULL;
816 cv_init(&tqe->tqent_cv, NULL, CV_DEFAULT, NULL);
825 taskq_ent_t *tqe = buf;
827 ASSERT(tqe->tqent_thread == NULL);
828 cv_destroy(&tqe->tqent_cv);
973 taskq_ent_t *tqe;
983 again: if ((tqe = tq->tq_freelist) != NULL &&
985 tq->tq_freelist = tqe->tqent_next;
1019 tqe = kmem_cache_alloc(taskq_ent_cache, kmflags);
1022 if (tqe != NULL)
1025 return (tqe);
1037 taskq_ent_free(taskq_t *tq, taskq_ent_t *tqe)
1042 tqe->tqent_next = tq->tq_freelist;
1043 tq->tq_freelist = tqe;
1047 kmem_cache_free(taskq_ent_cache, tqe);
1065 taskq_ent_t *tqe;
1069 for (tqe = tq->tq_task.tqent_next; tqe != &tq->tq_task;
1070 tqe = tqe->tqent_next)
1071 if ((tqe->tqent_func == func) && (tqe->tqent_arg == arg))
1087 taskq_ent_t *tqe;
1103 tqe = b->tqbucket_freelist.tqent_prev;
1105 ASSERT(tqe != &b->tqbucket_freelist);
1106 ASSERT(tqe->tqent_thread != NULL);
1108 tqe->tqent_prev->tqent_next = tqe->tqent_next;
1109 tqe->tqent_next->tqent_prev = tqe->tqent_prev;
1112 tqe->tqent_func = func;
1113 tqe->tqent_arg = arg;
1115 cv_signal(&tqe->tqent_cv);
1117 taskq_ent_t *, tqe);
1119 tqe = NULL;
1123 return (tqe);
1140 taskq_ent_t *tqe = NULL;
1159 if ((tqe = taskq_ent_alloc(tq, flags)) == NULL) {
1164 tqe->tqent_un.tqent_flags = 0;
1167 TQ_ENQUEUE_FRONT(tq, tqe, func, arg);
1169 TQ_ENQUEUE(tq, tqe, func, arg);
1172 return ((taskqid_t)tqe);
1188 if ((tqe = taskq_bucket_dispatch(tq->tq_buckets, func, arg))
1190 return ((taskqid_t)tqe); /* Fastpath */
1213 if ((tqe = taskq_bucket_dispatch(b, func, arg)) != NULL)
1214 return ((taskqid_t)tqe); /* Fastpath */
1231 tqe = taskq_bucket_dispatch(b, func, arg);
1235 } while ((tqe == NULL) && (loopcount > 0));
1239 * At this point we either scheduled a task and (tqe != NULL) or failed
1240 * (tqe == NULL). Try to recover from fails.
1246 if ((tqe == NULL) && !(flags & TQ_NOSLEEP)) {
1257 if ((tqe = taskq_bucket_dispatch(bucket, func, arg)) != NULL)
1258 return ((taskqid_t)tqe);
1281 if ((tqe == NULL) && !(flags & TQ_NOQUEUE)) {
1282 if ((tqe = taskq_ent_alloc(tq, flags)) != NULL) {
1283 TQ_ENQUEUE(tq, tqe, func, arg);
1290 return ((taskqid_t)tqe);
1295 taskq_ent_t *tqe)
1304 tqe->tqent_un.tqent_flags |= TQENT_FLAG_PREALLOC;
1311 TQ_ENQUEUE_FRONT(tq, tqe, func, arg);
1313 TQ_ENQUEUE(tq, tqe, func, arg);
1509 taskq_ent_t *tqe;
1586 if ((tqe = tq->tq_task.tqent_next) == &tq->tq_task) {
1595 tqe->tqent_prev->tqent_next = tqe->tqent_next;
1596 tqe->tqent_next->tqent_prev = tqe->tqent_prev;
1608 (tqe->tqent_un.tqent_flags & TQENT_FLAG_PREALLOC)) {
1610 tqe->tqent_next = tqe->tqent_prev = NULL;
1619 taskq_ent_t *, tqe);
1620 tqe->tqent_func(tqe->tqent_arg);
1622 taskq_ent_t *, tqe);
1631 taskq_ent_free(tq, tqe);
1669 taskq_d_thread(taskq_ent_t *tqe)
1671 taskq_bucket_t *bucket = tqe->tqent_un.tqent_bucket;
1674 kcondvar_t *cv = &tqe->tqent_cv;
1687 if (tqe->tqent_func != NULL) {
1707 taskq_bucket_t *, bucket, taskq_ent_t *, tqe);
1708 tqe->tqent_func(tqe->tqent_arg);
1710 taskq_bucket_t *, bucket, taskq_ent_t *, tqe);
1718 tqe->tqent_func = NULL;
1719 TQ_APPEND(bucket->tqbucket_freelist, tqe);
1756 ASSERT((tqe->tqent_func != NULL) ||
1759 ASSERT((tqe->tqent_func == NULL) ||
1768 if ((tqe->tqent_func == NULL) &&
1779 tqe->tqent_prev->tqent_next = tqe->tqent_next;
1780 tqe->tqent_next->tqent_prev = tqe->tqent_prev;
1786 tqe->tqent_thread = NULL;
1791 kmem_cache_free(taskq_ent_cache, tqe);
2105 taskq_ent_t *tqe;
2112 for (tqe = b->tqbucket_freelist.tqent_next;
2113 tqe != &b->tqbucket_freelist; tqe = tqe->tqent_next)
2114 cv_signal(&tqe->tqent_cv);
2169 taskq_ent_t *tqe;
2191 tqe = kmem_cache_alloc(taskq_ent_cache, KM_NOSLEEP);
2193 if (tqe == NULL) {
2201 ASSERT(tqe->tqent_thread == NULL);
2203 tqe->tqent_un.tqent_bucket = b;
2209 tqe->tqent_thread = thread_create(NULL, 0, taskq_d_thread, tqe,
2216 tqe->tqent_func = NULL;
2217 TQ_APPEND(b->tqbucket_freelist, tqe);
2232 thread_lock(tqe->tqent_thread);
2233 tqe->tqent_thread->t_taskq = tq;
2234 tqe->tqent_thread->t_schedflag |= TS_ALLSTART;
2235 setrun_locked(tqe->tqent_thread);
2236 thread_unlock(tqe->tqent_thread);