Lines Matching refs:qp
473 queue_head_t *qp; in queue_alloc() local
486 udp->queue_head = qp = (queue_head_t *)data; in queue_alloc()
487 for (i = 0; i < 2 * QHASHSIZE; qp++, i++) { in queue_alloc()
488 qp->qh_type = (i < QHASHSIZE)? MX : CV; in queue_alloc()
489 qp->qh_lock.mutex_flag = LOCK_INITED; in queue_alloc()
490 qp->qh_lock.mutex_magic = MUTEX_MAGIC; in queue_alloc()
491 qp->qh_hlist = &qp->qh_def_root; in queue_alloc()
493 qp->qh_hlen = 1; in queue_alloc()
494 qp->qh_hmax = 1; in queue_alloc()
505 QVERIFY(queue_head_t *qp) in QVERIFY() argument
517 ASSERT(qp >= udp->queue_head && (qp - udp->queue_head) < 2 * QHASHSIZE); in QVERIFY()
518 ASSERT(MUTEX_OWNED(&qp->qh_lock, self)); in QVERIFY()
519 for (cnt = 0, qrp = qp->qh_hlist; qrp != NULL; qrp = qrp->qr_next) { in QVERIFY()
524 ASSERT(qp->qh_hlen == cnt && qp->qh_hmax >= cnt); in QVERIFY()
525 qtype = ((qp - udp->queue_head) < QHASHSIZE)? MX : CV; in QVERIFY()
526 ASSERT(qp->qh_type == qtype); in QVERIFY()
530 for (cnt = 0, qrp = qp->qh_hlist; qrp != NULL; qrp = qrp->qr_next) { in QVERIFY()
538 ASSERT(ulwp->ul_sleepq == qp); in QVERIFY()
542 ASSERT(&udp->queue_head[index] == qp); in QVERIFY()
546 ASSERT(qp->qh_qlen == cnt); in QVERIFY()
551 #define QVERIFY(qp) argument
562 queue_head_t *qp; in queue_lock() local
571 if ((qp = udp->queue_head) == NULL) { in queue_lock()
573 qp = udp->queue_head; in queue_lock()
575 qp += QUEUE_HASH(wchan, qtype); in queue_lock()
576 spin_lock_set(&qp->qh_lock); in queue_lock()
577 for (qrp = qp->qh_hlist; qrp != NULL; qrp = qrp->qr_next) in queue_lock()
580 if (qrp == NULL && qp->qh_def_root.qr_head == NULL) { in queue_lock()
582 qrp = &qp->qh_def_root; in queue_lock()
588 qp->qh_wchan = wchan; /* valid until queue_unlock() is called */ in queue_lock()
589 qp->qh_root = qrp; /* valid until queue_unlock() is called */ in queue_lock()
590 INCR32(qp->qh_lockcount); in queue_lock()
591 QVERIFY(qp); in queue_lock()
592 return (qp); in queue_lock()
599 queue_unlock(queue_head_t *qp) in queue_unlock() argument
601 QVERIFY(qp); in queue_unlock()
602 spin_lock_clear(&qp->qh_lock); in queue_unlock()
613 enqueue(queue_head_t *qp, ulwp_t *ulwp, int force_fifo) in enqueue() argument
620 ASSERT(MUTEX_OWNED(&qp->qh_lock, curthread)); in enqueue()
621 ASSERT(ulwp->ul_sleepq != qp); in enqueue()
623 if ((qrp = qp->qh_root) == NULL) { in enqueue()
626 qrp->qr_next = qp->qh_hlist; in enqueue()
630 qrp->qr_wchan = qp->qh_wchan; in enqueue()
634 qp->qh_hlist->qr_prev = qrp; in enqueue()
635 qp->qh_hlist = qrp; in enqueue()
636 qp->qh_root = qrp; in enqueue()
637 MAXINCR(qp->qh_hmax, qp->qh_hlen); in enqueue()
670 (((++qp->qh_qcnt << curthread->ul_queue_fifo) & 0xff) == 0)) { in enqueue()
699 ulwp->ul_sleepq = qp; in enqueue()
700 ulwp->ul_wchan = qp->qh_wchan; in enqueue()
701 ulwp->ul_qtype = qp->qh_type; in enqueue()
709 MAXINCR(qp->qh_qmax, qp->qh_qlen); in enqueue()
782 queue_slot(queue_head_t *qp, ulwp_t **prevp, int *more) in queue_slot() argument
789 ASSERT(MUTEX_OWNED(&qp->qh_lock, curthread)); in queue_slot()
791 if ((qrp = qp->qh_root) == NULL || (ulwp = qrp->qr_head) == NULL) { in queue_slot()
827 queue_unlink(queue_head_t *qp, ulwp_t **ulwpp, ulwp_t *prev) in queue_unlink() argument
829 queue_root_t *qrp = qp->qh_root; in queue_unlink()
834 ASSERT(MUTEX_OWNED(&qp->qh_lock, curthread)); in queue_unlink()
835 ASSERT(qp->qh_wchan != NULL && ulwp->ul_wchan == qp->qh_wchan); in queue_unlink()
837 DECR(qp->qh_qlen); in queue_unlink()
866 qp->qh_hlist = nqrp; in queue_unlink()
867 qp->qh_root = nqrp; in queue_unlink()
876 qp->qh_hlist = qr_next; in queue_unlink()
877 qp->qh_root = NULL; in queue_unlink()
878 DECR(qp->qh_hlen); in queue_unlink()
884 dequeue(queue_head_t *qp, int *more) in dequeue() argument
890 if ((ulwpp = queue_slot(qp, &prev, more)) == NULL) in dequeue()
893 queue_unlink(qp, ulwpp, prev); in dequeue()
903 queue_waiter(queue_head_t *qp) in queue_waiter() argument
909 if ((ulwpp = queue_slot(qp, &prev, &more)) == NULL) in queue_waiter()
915 dequeue_self(queue_head_t *qp) in dequeue_self() argument
924 ASSERT(MUTEX_OWNED(&qp->qh_lock, self)); in dequeue_self()
927 if ((qrp = qp->qh_root) != NULL) { in dequeue_self()
932 queue_unlink(qp, ulwpp, prev); in dequeue_self()
945 return ((qrp = qp->qh_root) != NULL && qrp->qr_head != NULL); in dequeue_self()
956 queue_head_t *qp; in unsleep_self() local
964 qp = queue_lock(self->ul_wchan, self->ul_qtype); in unsleep_self()
971 if (qp == self->ul_sleepq) in unsleep_self()
972 (void) dequeue_self(qp); in unsleep_self()
973 queue_unlock(qp); in unsleep_self()
1620 queue_head_t *qp; in mutex_wakeup() local
1628 qp = queue_lock(mp, MX); in mutex_wakeup()
1629 if ((ulwp = dequeue(qp, &more)) != NULL) { in mutex_wakeup()
1633 queue_unlock(qp); in mutex_wakeup()
1643 queue_head_t *qp; in mutex_wakeup_all() local
1667 qp = queue_lock(mp, MX); in mutex_wakeup_all()
1669 if ((qrp = qp->qh_root) == NULL || in mutex_wakeup_all()
1673 queue_unlink(qp, &qrp->qr_head, NULL); in mutex_wakeup_all()
1682 queue_unlock(qp); in mutex_wakeup_all()
1686 queue_unlock(qp); in mutex_wakeup_all()
1788 queue_head_t *qp; in mutex_lock_queue() local
1812 qp = queue_lock(mp, MX); in mutex_lock_queue()
1813 enqueue(qp, self, 0); in mutex_lock_queue()
1818 mp->mutex_waiters = dequeue_self(qp); in mutex_lock_queue()
1822 queue_unlock(qp); in mutex_lock_queue()
1837 qp = queue_lock(mp, MX); in mutex_lock_queue()
1840 mp->mutex_waiters = queue_waiter(qp)? 1 : 0; in mutex_lock_queue()
1849 enqueue(qp, self, 0); in mutex_lock_queue()
1852 ASSERT(self->ul_sleepq == qp && in mutex_lock_queue()
1857 mp->mutex_waiters = dequeue_self(qp); in mutex_lock_queue()
1880 queue_unlock(qp); in mutex_lock_queue()
3227 queue_head_t *qp; in cond_sleep_queue() local
3242 qp = queue_lock(cvp, CV); in cond_sleep_queue()
3243 enqueue(qp, self, 0); in cond_sleep_queue()
3256 queue_unlock(qp); in cond_sleep_queue()
3284 qp = queue_lock(cvp, CV); in cond_sleep_queue()
3301 } else if (self->ul_sleepq == qp) { /* condvar queue */ in cond_sleep_queue()
3303 cvp->cond_waiters_user = dequeue_self(qp); in cond_sleep_queue()
3325 queue_unlock(qp); in cond_sleep_queue()
3816 queue_head_t *qp; in cond_signal() local
3839 qp = queue_lock(cvp, CV); in cond_signal()
3840 ulwpp = queue_slot(qp, &prev, &more); in cond_signal()
3843 queue_unlock(qp); in cond_signal()
3861 queue_unlink(qp, ulwpp, prev); in cond_signal()
3873 queue_unlock(qp); in cond_signal()
3882 queue_unlock(qp); in cond_signal()
3945 queue_head_t *qp; in cond_broadcast() local
3984 qp = queue_lock(cvp, CV); in cond_broadcast()
3987 if ((qrp = qp->qh_root) == NULL || in cond_broadcast()
3991 queue_unlink(qp, &qrp->qr_head, NULL); in cond_broadcast()
4017 queue_unlock(qp); in cond_broadcast()
4020 queue_unlock(qp); in cond_broadcast()
4081 queue_head_t *qp; in dump_queue_statistics() local
4091 for (qn = 0, qp = udp->queue_head; qn < QHASHSIZE; qn++, qp++) { in dump_queue_statistics()
4092 if (qp->qh_lockcount == 0) in dump_queue_statistics()
4094 spin_lock_total += qp->qh_lockcount; in dump_queue_statistics()
4096 (u_longlong_t)qp->qh_lockcount, in dump_queue_statistics()
4097 qp->qh_qmax, qp->qh_hmax) < 0) in dump_queue_statistics()
4104 for (qn = 0; qn < QHASHSIZE; qn++, qp++) { in dump_queue_statistics()
4105 if (qp->qh_lockcount == 0) in dump_queue_statistics()
4107 spin_lock_total += qp->qh_lockcount; in dump_queue_statistics()
4109 (u_longlong_t)qp->qh_lockcount, in dump_queue_statistics()
4110 qp->qh_qmax, qp->qh_hmax) < 0) in dump_queue_statistics()