Lines Matching defs:sq

170 static int	sleepq_resume_thread(struct sleepqueue *sq, struct thread *td,
246 sleepq_free(struct sleepqueue *sq)
249 uma_zfree(sleepq_zone, sq);
273 struct sleepqueue *sq;
278 LIST_FOREACH(sq, &sc->sc_queues, sq_hash)
279 if (sq->sq_wchan == wchan)
280 return (sq);
307 struct sleepqueue *sq;
323 sq = sleepq_lookup(wchan);
330 if (sq == NULL) {
334 sq = td->td_sleepqueue;
336 KASSERT(TAILQ_EMPTY(&sq->sq_blocked[i]),
338 KASSERT(sq->sq_blockedcnt[i] == 0,
341 KASSERT(LIST_EMPTY(&sq->sq_free),
343 KASSERT(sq->sq_wchan == NULL, ("stale sq_wchan pointer"));
344 sq->sq_lock = lock;
354 sq = td->td_sleepqueue;
355 LIST_INSERT_HEAD(&sc->sc_queues, sq, sq_hash);
356 sq->sq_wchan = wchan;
357 sq->sq_type = flags & SLEEPQ_TYPE;
359 MPASS(wchan == sq->sq_wchan);
360 MPASS(lock == sq->sq_lock);
361 MPASS((flags & SLEEPQ_TYPE) == sq->sq_type);
362 LIST_INSERT_HEAD(&sq->sq_free, td->td_sleepqueue, sq_hash);
365 TAILQ_INSERT_TAIL(&sq->sq_blocked[queue], td, td_slpq);
366 sq->sq_blockedcnt[queue]++;
414 struct sleepqueue *sq;
418 sq = sleepq_lookup(wchan);
419 if (sq == NULL)
421 return (sq->sq_blockedcnt[queue]);
434 struct sleepqueue *sq;
536 sq = sleepq_lookup(wchan);
537 if (sleepq_resume_thread(sq, td, 0)) {
560 struct sleepqueue *sq;
603 sq = sleepq_lookup(wchan);
604 if (sleepq_resume_thread(sq, td, 0)) {
772 struct sleepqueue *sq;
778 sq = sleepq_lookup(wchan);
779 if (sq == NULL) {
783 type = sq->sq_type;
793 sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
798 MPASS(sq->sq_wchan != NULL);
799 MPASS(td->td_wchan == sq->sq_wchan);
802 sc = SC_LOOKUP(sq->sq_wchan);
808 sq->sq_blockedcnt[td->td_sqqueue]--;
809 TAILQ_REMOVE(&sq->sq_blocked[td->td_sqqueue], td, td_slpq);
816 if (LIST_EMPTY(&sq->sq_free)) {
817 td->td_sleepqueue = sq;
819 sq->sq_wchan = NULL;
825 td->td_sleepqueue = LIST_FIRST(&sq->sq_free);
861 struct sleepqueue *sq;
864 sq = mem;
866 MPASS(TAILQ_EMPTY(&sq->sq_blocked[i]));
867 MPASS(sq->sq_blockedcnt[i] == 0);
878 struct sleepqueue *sq;
882 sq = mem;
884 TAILQ_INIT(&sq->sq_blocked[i]);
885 sq->sq_blockedcnt[i] = 0;
887 LIST_INIT(&sq->sq_free);
898 struct sleepqueue *sq;
906 sq = sleepq_lookup(wchan);
907 if (sq == NULL)
909 KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE),
912 head = &sq->sq_blocked[queue];
942 wakeup_swapper = sleepq_resume_thread(sq, besttd, pri);
960 struct sleepqueue *sq;
965 sq = sleepq_lookup(wchan);
966 if (sq == NULL)
968 KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE),
971 return (sleepq_remove_matching(sq, queue, match_any, pri));
978 sleepq_remove_matching(struct sleepqueue *sq, int queue,
985 * The last thread will be given ownership of sq and may
991 TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) {
994 wakeup_swapper |= sleepq_resume_thread(sq, td, pri);
1009 struct sleepqueue *sq;
1033 sq = sleepq_lookup(wchan);
1034 MPASS(sq != NULL);
1036 wakeup_swapper = sleepq_resume_thread(sq, td, 0);
1059 struct sleepqueue *sq;
1069 sq = sleepq_lookup(wchan);
1080 /* Thread is asleep on sleep queue sq, so wake it up. */
1082 MPASS(sq != NULL);
1084 wakeup_swapper = sleepq_resume_thread(sq, td, 0);
1098 struct sleepqueue *sq;
1126 sq = sleepq_lookup(wchan);
1127 MPASS(sq != NULL);
1129 /* Thread is asleep on sleep queue sq, so wake it up. */
1130 return (sleepq_resume_thread(sq, td, 0));
1137 struct sleepqueue *sq, *sq1;
1146 LIST_FOREACH_SAFE(sq, &sc->sc_queues, sq_hash, sq1) {
1148 wakeup_swapper |= sleepq_remove_matching(sq, i,
1171 struct sleepqueue *sq;
1213 sq = sleepq_lookup(wchan);
1214 if (sq == NULL) {
1224 TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq,
1424 struct sleepqueue *sq;
1441 LIST_FOREACH(sq, &sc->sc_queues, sq_hash)
1442 if (sq->sq_wchan == wchan)
1450 LIST_FOREACH(sq, &sleepq_chains[i].sc_queues, sq_hash) {
1451 if (sq == (struct sleepqueue *)addr)
1458 db_printf("Wait channel: %p\n", sq->sq_wchan);
1459 db_printf("Queue type: %d\n", sq->sq_type);
1461 if (sq->sq_lock) {
1462 lock = sq->sq_lock;
1470 if (TAILQ_EMPTY(&sq->sq_blocked[i]))
1473 TAILQ_FOREACH(td, &sq->sq_blocked[i],
1479 db_printf("(expected: %u)\n", sq->sq_blockedcnt[i]);