Lines Matching refs:t
96 kthread_t *t; in lwp_create() local
174 if ((t = lwp_deathrow) != NULL) { in lwp_create()
175 ASSERT(t->t_swap); in lwp_create()
176 lwp_deathrow = t->t_forw; in lwp_create()
178 lwpdata = t->t_swap; in lwp_create()
179 lwp = t->t_lwp; in lwp_create()
180 ctx = t->t_ctx; in lwp_create()
181 t->t_swap = NULL; in lwp_create()
182 t->t_lwp = NULL; in lwp_create()
183 t->t_ctx = NULL; in lwp_create()
184 reapq_move_lq_to_tq(t); in lwp_create()
223 t = thread_create(lwpdata, stksize, NULL, NULL, 0, p, TS_STOPPED, pri); in lwp_create()
238 ASSERT(t->t_swap == NULL); in lwp_create()
239 t->t_swap = lwpdata; /* Start of page-able data */ in lwp_create()
248 t->t_flag |= T_LWPREUSE; in lwp_create()
253 t->t_lwp = lwp; in lwp_create()
255 t->t_hold = *smask; in lwp_create()
256 lwp->lwp_thread = t; in lwp_create()
262 t->t_stk = lwp_stk_init(lwp, t->t_stk); in lwp_create()
263 thread_load(t, proc, arg, len); in lwp_create()
269 t->t_rprof = kmem_zalloc(sizeof (struct rprof), KM_SLEEP); in lwp_create()
504 t->t_bind_cpu = binding = PBIND_NONE; in lwp_create()
505 t->t_cpupart = oldpart = &cp_default; in lwp_create()
506 t->t_bind_pset = PS_NONE; in lwp_create()
507 t->t_bindflag = (uchar_t)default_binding_mode; in lwp_create()
510 t->t_bind_cpu = binding; in lwp_create()
511 oldpart = t->t_cpupart; in lwp_create()
512 t->t_cpupart = curthread->t_cpupart; in lwp_create()
513 t->t_bind_pset = curthread->t_bind_pset; in lwp_create()
514 t->t_bindflag = curthread->t_bindflag | in lwp_create()
524 if (binding != PBIND_NONE && t->t_affinitycnt == 0) { in lwp_create()
525 t->t_bound_cpu = cpu[binding]; in lwp_create()
526 if (t->t_lpl != t->t_bound_cpu->cpu_lpl) in lwp_create()
527 lgrp_move_thread(t, t->t_bound_cpu->cpu_lpl, 1); in lwp_create()
532 lgrp_move_thread(t, in lwp_create()
533 &t->t_cpupart->cp_lgrploads[LGRP_ROOTID], 1); in lwp_create()
535 lgrp_move_thread(t, lgrp_choose(t, t->t_cpupart), 1); in lwp_create()
543 ASSERT(t->t_lpl >= t->t_cpupart->cp_lgrploads); in lwp_create()
544 ASSERT(t->t_lpl < t->t_cpupart->cp_lgrploads + in lwp_create()
545 t->t_cpupart->cp_nlgrploads); in lwp_create()
553 oldkpj = ttoproj(t); in lwp_create()
555 t->t_proj = newkpj; in lwp_create()
569 err = CL_ENTERCLASS(t, cid, NULL, NULL, bufp); in lwp_create()
570 t->t_pri = pri; /* CL_ENTERCLASS may have changed it */ in lwp_create()
577 t->t_clfuncs = &(sclass[cid].cl_funcs->thread); in lwp_create()
578 err = CL_FORK(curthread, t, bufp); in lwp_create()
579 t->t_cid = cid; in lwp_create()
591 t->t_tid = lwpid; in lwp_create()
606 if ((t->t_tid = ++p->p_lwpid) == prev_id) { in lwp_create()
620 } while (lwp_hash_lookup(p, t->t_tid) != NULL); in lwp_create()
635 if (t->t_tid == 1) { in lwp_create()
637 ASSERT(t->t_lpl != NULL); in lwp_create()
638 p->p_t1_lgrpid = t->t_lpl->lpl_lgrpid; in lwp_create()
647 t->t_waitfor = -1; in lwp_create()
653 t->t_proc_flag |= TP_MSACCT; in lwp_create()
659 watch_enable(t); in lwp_create()
672 init_mstate(t, LMS_STOPPED); in lwp_create()
673 t->t_proc_flag |= TP_HOLDLWP; in lwp_create()
674 t->t_schedflag |= (TS_ALLSTART & ~(TS_CSTART | TS_CREATE)); in lwp_create()
675 t->t_whystop = PR_SUSPENDED; in lwp_create()
676 t->t_whatstop = SUSPEND_NORMAL; in lwp_create()
677 t->t_sig_check = 1; /* ensure that TP_HOLDLWP is honored */ in lwp_create()
684 t->t_pre_sys = 1; in lwp_create()
685 t->t_post_sys = 1; in lwp_create()
691 t->t_back = t; in lwp_create()
692 t->t_forw = t; in lwp_create()
693 p->p_tlist = t; in lwp_create()
695 t->t_forw = tx; in lwp_create()
696 t->t_back = tx->t_back; in lwp_create()
697 tx->t_back->t_forw = t; in lwp_create()
698 tx->t_back = t; in lwp_create()
705 lep->le_thread = t; in lwp_create()
706 lep->le_lwpid = t->t_tid; in lwp_create()
707 lep->le_start = t->t_start; in lwp_create()
714 t->t_proc_flag &= ~TP_HOLDLWP; in lwp_create()
715 lwp_create_done(t); in lwp_create()
733 lgrp_move_thread(t, NULL, 1); in lwp_create()
749 t->t_state = TS_FREE; in lwp_create()
750 thread_rele(t); in lwp_create()
757 ASSERT(t != t->t_next); /* t0 never exits */ in lwp_create()
758 t->t_next->t_prev = t->t_prev; in lwp_create()
759 t->t_prev->t_next = t->t_next; in lwp_create()
762 thread_free(t); in lwp_create()
776 DTRACE_PROC1(lwp__create, kthread_t *, t); in lwp_create()
785 lwp_create_done(kthread_t *t) in lwp_create_done() argument
787 proc_t *p = ttoproc(t); in lwp_create_done()
797 thread_lock(t); in lwp_create_done()
798 ASSERT(t->t_state == TS_STOPPED && !(t->t_schedflag & TS_CREATE)); in lwp_create_done()
803 if (!(t->t_schedflag & TS_CSTART)) in lwp_create_done()
805 t->t_schedflag |= (TS_CSTART | TS_CREATE); in lwp_create_done()
806 setrun_locked(t); in lwp_create_done()
807 thread_unlock(t); in lwp_create_done()
853 kthread_t *t = curthread; in lwp_exit() local
854 klwp_t *lwp = ttolwp(t); in lwp_exit()
855 proc_t *p = ttoproc(t); in lwp_exit()
874 if (t->t_door) in lwp_exit()
877 if (t->t_schedctl != NULL) in lwp_exit()
878 schedctl_lwp_cleanup(t); in lwp_exit()
880 if (t->t_upimutex != NULL) in lwp_exit()
912 if (!(t->t_proc_flag & TP_DAEMON) && in lwp_exit()
938 prlwpexit(t); /* notify /proc */ in lwp_exit()
939 if (!(t->t_proc_flag & TP_TWAIT) || (p->p_flag & SEXITLWPS)) in lwp_exit()
940 lwp_hash_out(p, t->t_tid); in lwp_exit()
942 ASSERT(!(t->t_proc_flag & TP_DAEMON)); in lwp_exit()
943 p->p_lwpdir[t->t_dslot].ld_entry->le_thread = NULL; in lwp_exit()
947 if (t->t_proc_flag & TP_DAEMON) { in lwp_exit()
949 t->t_proc_flag &= ~TP_DAEMON; in lwp_exit()
951 t->t_proc_flag &= ~TP_TWAIT; in lwp_exit()
962 CL_EXIT(t); /* tell the scheduler that t is exiting */ in lwp_exit()
974 t->t_proc_flag |= TP_LWPEXIT; in lwp_exit()
975 term_mstate(t); in lwp_exit()
979 if (t->t_tnf_tpdp) in lwp_exit()
983 t->t_forw->t_back = t->t_back; in lwp_exit()
984 t->t_back->t_forw = t->t_forw; in lwp_exit()
985 if (t == p->p_tlist) in lwp_exit()
986 p->p_tlist = t->t_forw; in lwp_exit()
991 if (t->t_sigqueue != NULL) in lwp_exit()
992 sigdelq(p, t, 0); in lwp_exit()
998 thread_rele(t); in lwp_exit()
1004 t->t_preempt++; in lwp_exit()
1006 if (t->t_ctx != NULL) in lwp_exit()
1007 exitctx(t); in lwp_exit()
1011 t->t_procp = &p0; in lwp_exit()
1016 hat_thread_exit(t); in lwp_exit()
1025 if (--p->p_lwprcnt == 0 || (t->t_proc_flag & TP_HOLDLWP) || in lwp_exit()
1035 ASSERT(t != t->t_next); /* t0 never exits */ in lwp_exit()
1036 t->t_next->t_prev = t->t_prev; in lwp_exit()
1037 t->t_prev->t_next = t->t_next; in lwp_exit()
1038 cv_broadcast(&t->t_joincv); /* wake up anyone in thread_join */ in lwp_exit()
1041 t->t_state = TS_ZOMB; in lwp_exit()
1055 kthread_t *t = curthread; in lwp_cleanup() local
1056 proc_t *p = ttoproc(t); in lwp_cleanup()
1068 if (t == p->p_agenttp) { in lwp_cleanup()
1069 ASSERT(t->t_tid == p->p_lwpid); in lwp_cleanup()
1078 lgrp_move_thread(t, NULL, 1); in lwp_cleanup()
1079 if (t->t_tid == 1) { in lwp_cleanup()
1084 lwp_ctmpl_clear(ttolwp(t)); in lwp_cleanup()
1088 lwp_suspend(kthread_t *t) in lwp_suspend() argument
1091 proc_t *p = ttoproc(t); in lwp_suspend()
1100 t->t_proc_flag |= TP_HOLDLWP; in lwp_suspend()
1101 if (t == curthread) { in lwp_suspend()
1102 t->t_sig_check = 1; in lwp_suspend()
1107 thread_lock(t); in lwp_suspend()
1108 t->t_sig_check = 1; in lwp_suspend()
1113 if (ISWAKEABLE(t) || ISWAITING(t)) { in lwp_suspend()
1114 setrun_locked(t); in lwp_suspend()
1115 } else if (t->t_state == TS_ONPROC && t->t_cpu != CPU) { in lwp_suspend()
1116 poke_cpu(t->t_cpu->cpu_id); in lwp_suspend()
1119 tid = t->t_tid; /* remember thread ID */ in lwp_suspend()
1123 while (!SUSPENDED(t)) { in lwp_suspend()
1129 thread_unlock(t); in lwp_suspend()
1155 thread_lock(t); in lwp_suspend()
1161 if ((t->t_proc_flag & TP_HOLDLWP) == 0) { in lwp_suspend()
1162 thread_unlock(t); in lwp_suspend()
1166 thread_unlock(t); in lwp_suspend()
1175 lwp_continue(kthread_t *t) in lwp_continue() argument
1177 proc_t *p = ttoproc(t); in lwp_continue()
1178 int was_suspended = t->t_proc_flag & TP_HOLDLWP; in lwp_continue()
1182 t->t_proc_flag &= ~TP_HOLDLWP; in lwp_continue()
1183 thread_lock(t); in lwp_continue()
1184 if (SUSPENDED(t) && in lwp_continue()
1187 t->t_schedflag |= TS_CSTART; in lwp_continue()
1188 setrun_locked(t); in lwp_continue()
1190 thread_unlock(t); in lwp_continue()
1224 kthread_t *t = curthread; in holdlwp() local
1232 if ((p->p_flag & SEXITLWPS) || (t->t_proc_flag & TP_EXITLWP)) in holdlwp()
1423 kthread_t *t = curthread; in holdwatch() local
1464 t->t_proc_flag &= ~TP_WATCHSTOP; in holdwatch()
1498 t->t_proc_flag |= TP_WATCHSTOP; in holdwatch()
1503 t->t_proc_flag &= ~TP_WATCHSTOP; in holdwatch()
1515 t->t_proc_flag &= ~TP_WATCHSTOP; in holdwatch()
1534 ASSERT(t->t_proc_flag & TP_STOPPING); in holdwatch()
1549 kthread_t *t; in pokelwps() local
1553 t = p->p_tlist; in pokelwps()
1555 if (t == curthread) in pokelwps()
1557 thread_lock(t); in pokelwps()
1558 aston(t); /* make thread trap or do post_syscall */ in pokelwps()
1559 if (ISWAKEABLE(t) || ISWAITING(t)) { in pokelwps()
1560 setrun_locked(t); in pokelwps()
1561 } else if (t->t_state == TS_STOPPED) { in pokelwps()
1568 t->t_schedflag |= (TS_XSTART | TS_PSTART); in pokelwps()
1569 setrun_locked(t); in pokelwps()
1578 if ((p->p_flag & SHOLDFORK) && SUSPENDED(t)) { in pokelwps()
1579 if ((t->t_schedflag & TS_CSTART) == 0) { in pokelwps()
1581 t->t_schedflag |= TS_CSTART; in pokelwps()
1582 setrun_locked(t); in pokelwps()
1585 } else if (t->t_state == TS_ONPROC) { in pokelwps()
1586 if (t->t_cpu != CPU) in pokelwps()
1587 poke_cpu(t->t_cpu->cpu_id); in pokelwps()
1589 thread_unlock(t); in pokelwps()
1590 } while ((t = t->t_forw) != p->p_tlist); in pokelwps()
1599 kthread_t *t; in continuelwps() local
1613 t = p->p_tlist; in continuelwps()
1615 thread_lock(t); /* SUSPENDED looks at t_schedflag */ in continuelwps()
1616 if (SUSPENDED(t) && !(t->t_proc_flag & TP_HOLDLWP)) { in continuelwps()
1618 t->t_schedflag |= TS_CSTART; in continuelwps()
1619 setrun_locked(t); in continuelwps()
1621 thread_unlock(t); in continuelwps()
1622 } while ((t = t->t_forw) != p->p_tlist); in continuelwps()
1725 kthread_t *t; in exitlwps() local
1726 for (t = curthread->t_forw; --heldcnt > 0; t = t->t_forw) { in exitlwps()
1727 t->t_proc_flag &= ~TP_TWAIT; in exitlwps()
1728 lwp_continue(t); in exitlwps()
1782 kthread_t *t = lwptot(lwp); in forklwp() local
1791 ASSERT(t == curthread || (SUSPENDED(t) && lwp->lwp_asleep == 0)); in forklwp()
1794 if (t == curthread) in forklwp()
1798 if (t == curthread) in forklwp()
1803 NULL, 0, cp, TS_STOPPED, t->t_pri, &t->t_hold, NOCLASS, lwpid); in forklwp()
1840 ct->t_sysnum = t->t_sysnum; in forklwp()
1856 if (t->t_ctx) in forklwp()
1857 forkctx(t, ct); in forklwp()
1860 if (t->t_door) in forklwp()
1861 door_fork(t, ct); in forklwp()
1868 if (!(t->t_proc_flag & TP_HOLDLWP)) in forklwp()
1879 cid = t->t_cid; in forklwp()
1885 if (cid != t->t_cid) { in forklwp()
1896 ct->t_unpark = t->t_unpark; in forklwp()
1897 ct->t_clfuncs = t->t_clfuncs; in forklwp()
1898 CL_FORK(t, ct, bufp); in forklwp()
1899 ct->t_cid = t->t_cid; /* after data allocated so prgetpsinfo works */ in forklwp()
1915 kthread_t *t; in lwp_hash_in() local
1939 if ((t = lep->le_thread) != NULL) { in lwp_hash_in()
1940 ASSERT(lep->le_lwpid == t->t_tid); in lwp_hash_in()
1941 t->t_dslot = (int)(ldp - p->p_lwpdir); in lwp_hash_in()