Lines Matching defs:sq
172 static void sleepq_resume_thread(struct sleepqueue *sq, struct thread *td,
174 static void sleepq_remove_thread(struct sleepqueue *sq, struct thread *td);
250 sleepq_free(struct sleepqueue *sq)
253 uma_zfree(sleepq_zone, sq);
277 struct sleepqueue *sq;
282 LIST_FOREACH(sq, &sc->sc_queues, sq_hash)
283 if (sq->sq_wchan == wchan)
284 return (sq);
311 struct sleepqueue *sq;
332 sq = sleepq_lookup(wchan);
339 if (sq == NULL) {
343 sq = td->td_sleepqueue;
345 KASSERT(TAILQ_EMPTY(&sq->sq_blocked[i]),
347 KASSERT(sq->sq_blockedcnt[i] == 0,
350 KASSERT(LIST_EMPTY(&sq->sq_free),
352 KASSERT(sq->sq_wchan == NULL, ("stale sq_wchan pointer"));
353 sq->sq_lock = lock;
363 sq = td->td_sleepqueue;
364 LIST_INSERT_HEAD(&sc->sc_queues, sq, sq_hash);
365 sq->sq_wchan = wchan;
366 sq->sq_type = flags & SLEEPQ_TYPE;
368 MPASS(wchan == sq->sq_wchan);
369 MPASS(lock == sq->sq_lock);
370 MPASS((flags & SLEEPQ_TYPE) == sq->sq_type);
371 LIST_INSERT_HEAD(&sq->sq_free, td->td_sleepqueue, sq_hash);
374 TAILQ_INSERT_TAIL(&sq->sq_blocked[queue], td, td_slpq);
375 sq->sq_blockedcnt[queue]++;
425 struct sleepqueue *sq;
429 sq = sleepq_lookup(wchan);
430 if (sq == NULL)
432 return (sq->sq_blockedcnt[queue]);
506 struct sleepqueue *sq;
530 sq = sleepq_lookup(wchan);
531 sleepq_remove_thread(sq, td);
549 struct sleepqueue *sq;
593 sq = sleepq_lookup(wchan);
594 sleepq_remove_thread(sq, td);
721 struct sleepqueue *sq;
726 sq = sleepq_lookup(wchan);
727 if (sq == NULL)
729 type = sq->sq_type;
741 sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri,
748 MPASS(sq->sq_wchan != NULL);
749 MPASS(td->td_wchan == sq->sq_wchan);
751 sc = SC_LOOKUP(sq->sq_wchan);
770 sleepq_remove_thread(sq, td);
799 sleepq_remove_thread(struct sleepqueue *sq, struct thread *td)
804 MPASS(sq->sq_wchan != NULL);
805 MPASS(td->td_wchan == sq->sq_wchan);
808 sc = SC_LOOKUP(sq->sq_wchan);
814 sq->sq_blockedcnt[td->td_sqqueue]--;
815 TAILQ_REMOVE(&sq->sq_blocked[td->td_sqqueue], td, td_slpq);
822 if (LIST_EMPTY(&sq->sq_free)) {
823 td->td_sleepqueue = sq;
825 sq->sq_wchan = NULL;
831 td->td_sleepqueue = LIST_FIRST(&sq->sq_free);
868 struct sleepqueue *sq;
876 sq = sleepq_lookup(wchan);
877 MPASS(sq != NULL);
879 sleepq_remove_thread(sq, td);
891 struct sleepqueue *sq;
894 sq = mem;
896 MPASS(TAILQ_EMPTY(&sq->sq_blocked[i]));
897 MPASS(sq->sq_blockedcnt[i] == 0);
908 struct sleepqueue *sq;
912 sq = mem;
914 TAILQ_INIT(&sq->sq_blocked[i]);
915 sq->sq_blockedcnt[i] = 0;
917 LIST_INIT(&sq->sq_free);
928 struct sleepqueue *sq;
935 sq = sleepq_lookup(wchan);
936 if (sq == NULL) {
941 KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE),
944 head = &sq->sq_blocked[queue];
973 sleepq_resume_thread(sq, besttd, pri,
990 struct sleepqueue *sq;
995 sq = sleepq_lookup(wchan);
996 if (sq != NULL) {
997 KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE),
1000 sleepq_remove_matching(sq, queue, match_any, pri);
1008 sleepq_remove_matching(struct sleepqueue *sq, int queue,
1014 * The last thread will be given ownership of sq and may
1019 TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) {
1021 sleepq_resume_thread(sq, td, pri, SRQ_HOLD);
1033 struct sleepqueue *sq;
1055 sq = sleepq_lookup(wchan);
1056 MPASS(sq != NULL);
1058 sleepq_resume_thread(sq, td, 0, 0);
1080 struct sleepqueue *sq;
1101 /* Thread is asleep on sleep queue sq, so wake it up. */
1102 sq = sleepq_lookup(wchan);
1103 MPASS(sq != NULL);
1105 sleepq_resume_thread(sq, td, 0, 0);
1117 struct sleepqueue *sq;
1150 sq = sleepq_lookup(wchan);
1151 MPASS(sq != NULL);
1153 /* Thread is asleep on sleep queue sq, so wake it up. */
1154 sleepq_resume_thread(sq, td, 0, 0);
1161 struct sleepqueue *sq, *sq1;
1169 LIST_FOREACH_SAFE(sq, &sc->sc_queues, sq_hash, sq1) {
1171 sleepq_remove_matching(sq, i, matches, 0);
1189 struct sleepqueue *sq;
1231 sq = sleepq_lookup(wchan);
1232 if (sq == NULL) {
1242 TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq,
1447 struct sleepqueue *sq;
1464 LIST_FOREACH(sq, &sc->sc_queues, sq_hash)
1465 if (sq->sq_wchan == wchan)
1473 LIST_FOREACH(sq, &sleepq_chains[i].sc_queues, sq_hash) {
1474 if (sq == (struct sleepqueue *)addr)
1481 db_printf("Wait channel: %p\n", sq->sq_wchan);
1482 db_printf("Queue type: %d\n", sq->sq_type);
1484 if (sq->sq_lock) {
1485 lock = sq->sq_lock;
1493 if (TAILQ_EMPTY(&sq->sq_blocked[i]))
1496 TAILQ_FOREACH(td, &sq->sq_blocked[i],
1502 db_printf("(expected: %u)\n", sq->sq_blockedcnt[i]);