Lines Matching refs:t

100 	kthread_t *t;  in lwp_create()  local
179 if ((t = lwp_deathrow) != NULL) { in lwp_create()
180 ASSERT(t->t_swap); in lwp_create()
181 lwp_deathrow = t->t_forw; in lwp_create()
183 lwpdata = t->t_swap; in lwp_create()
184 lwp = t->t_lwp; in lwp_create()
185 ctx = t->t_ctx; in lwp_create()
186 t->t_swap = NULL; in lwp_create()
187 t->t_lwp = NULL; in lwp_create()
188 t->t_ctx = NULL; in lwp_create()
189 reapq_move_lq_to_tq(t); in lwp_create()
230 t = thread_create(lwpdata, stksize, NULL, NULL, 0, p, TS_STOPPED, pri); in lwp_create()
245 ASSERT(t->t_swap == NULL); in lwp_create()
246 t->t_swap = lwpdata; /* Start of page-able data */ in lwp_create()
255 t->t_flag |= T_LWPREUSE; in lwp_create()
260 t->t_lwp = lwp; in lwp_create()
262 t->t_hold = *smask; in lwp_create()
263 lwp->lwp_thread = t; in lwp_create()
269 t->t_stk = lwp_stk_init(lwp, t->t_stk); in lwp_create()
270 thread_load(t, proc, arg, len); in lwp_create()
276 t->t_rprof = kmem_zalloc(sizeof (struct rprof), KM_SLEEP); in lwp_create()
511 t->t_bind_cpu = binding = PBIND_NONE; in lwp_create()
512 t->t_cpupart = oldpart = &cp_default; in lwp_create()
513 t->t_bind_pset = PS_NONE; in lwp_create()
514 t->t_bindflag = (uchar_t)default_binding_mode; in lwp_create()
517 t->t_bind_cpu = binding; in lwp_create()
518 oldpart = t->t_cpupart; in lwp_create()
519 t->t_cpupart = curthread->t_cpupart; in lwp_create()
520 t->t_bind_pset = curthread->t_bind_pset; in lwp_create()
521 t->t_bindflag = curthread->t_bindflag | in lwp_create()
531 if (binding != PBIND_NONE && t->t_affinitycnt == 0) { in lwp_create()
532 t->t_bound_cpu = cpu[binding]; in lwp_create()
533 if (t->t_lpl != t->t_bound_cpu->cpu_lpl) in lwp_create()
534 lgrp_move_thread(t, t->t_bound_cpu->cpu_lpl, 1); in lwp_create()
539 lgrp_move_thread(t, in lwp_create()
540 &t->t_cpupart->cp_lgrploads[LGRP_ROOTID], 1); in lwp_create()
542 lgrp_move_thread(t, lgrp_choose(t, t->t_cpupart), 1); in lwp_create()
550 ASSERT(t->t_lpl >= t->t_cpupart->cp_lgrploads); in lwp_create()
551 ASSERT(t->t_lpl < t->t_cpupart->cp_lgrploads + in lwp_create()
552 t->t_cpupart->cp_nlgrploads); in lwp_create()
560 oldkpj = ttoproj(t); in lwp_create()
562 t->t_proj = newkpj; in lwp_create()
576 err = CL_ENTERCLASS(t, cid, NULL, NULL, bufp); in lwp_create()
577 t->t_pri = pri; /* CL_ENTERCLASS may have changed it */ in lwp_create()
584 t->t_clfuncs = &(sclass[cid].cl_funcs->thread); in lwp_create()
585 err = CL_FORK(curthread, t, bufp); in lwp_create()
586 t->t_cid = cid; in lwp_create()
600 t->t_tid = lwpid; in lwp_create()
615 if ((t->t_tid = ++p->p_lwpid) == prev_id) { in lwp_create()
630 } while (lwp_hash_lookup(p, t->t_tid) != NULL); in lwp_create()
646 if (t->t_tid == 1) { in lwp_create()
648 ASSERT(t->t_lpl != NULL); in lwp_create()
649 p->p_t1_lgrpid = t->t_lpl->lpl_lgrpid; in lwp_create()
658 t->t_waitfor = -1; in lwp_create()
664 t->t_proc_flag |= TP_MSACCT; in lwp_create()
670 watch_enable(t); in lwp_create()
683 init_mstate(t, LMS_STOPPED); in lwp_create()
684 t->t_proc_flag |= TP_HOLDLWP; in lwp_create()
685 t->t_schedflag |= (TS_ALLSTART & ~(TS_CSTART | TS_CREATE)); in lwp_create()
686 t->t_whystop = PR_SUSPENDED; in lwp_create()
687 t->t_whatstop = SUSPEND_NORMAL; in lwp_create()
688 t->t_sig_check = 1; /* ensure that TP_HOLDLWP is honored */ in lwp_create()
695 t->t_pre_sys = 1; in lwp_create()
696 t->t_post_sys = 1; in lwp_create()
702 t->t_back = t; in lwp_create()
703 t->t_forw = t; in lwp_create()
704 p->p_tlist = t; in lwp_create()
706 t->t_forw = tx; in lwp_create()
707 t->t_back = tx->t_back; in lwp_create()
708 tx->t_back->t_forw = t; in lwp_create()
709 tx->t_back = t; in lwp_create()
716 lep->le_thread = t; in lwp_create()
717 lep->le_lwpid = t->t_tid; in lwp_create()
718 lep->le_start = t->t_start; in lwp_create()
725 t->t_proc_flag &= ~TP_HOLDLWP; in lwp_create()
726 lwp_create_done(t); in lwp_create()
744 lgrp_move_thread(t, NULL, 1); in lwp_create()
760 t->t_state = TS_FREE; in lwp_create()
761 thread_rele(t); in lwp_create()
768 ASSERT(t != t->t_next); /* t0 never exits */ in lwp_create()
769 t->t_next->t_prev = t->t_prev; in lwp_create()
770 t->t_prev->t_next = t->t_next; in lwp_create()
773 thread_free(t); in lwp_create()
787 DTRACE_PROC1(lwp__create, kthread_t *, t); in lwp_create()
796 lwp_create_done(kthread_t *t) in lwp_create_done() argument
798 proc_t *p = ttoproc(t); in lwp_create_done()
808 thread_lock(t); in lwp_create_done()
809 ASSERT(t->t_state == TS_STOPPED && !(t->t_schedflag & TS_CREATE)); in lwp_create_done()
814 if (!(t->t_schedflag & TS_CSTART)) in lwp_create_done()
816 t->t_schedflag |= (TS_CSTART | TS_CREATE); in lwp_create_done()
817 setrun_locked(t); in lwp_create_done()
818 thread_unlock(t); in lwp_create_done()
864 kthread_t *t = curthread; in lwp_exit() local
865 klwp_t *lwp = ttolwp(t); in lwp_exit()
866 proc_t *p = ttoproc(t); in lwp_exit()
885 if (t->t_door) in lwp_exit()
888 if (t->t_schedctl != NULL) in lwp_exit()
889 schedctl_lwp_cleanup(t); in lwp_exit()
891 if (t->t_upimutex != NULL) in lwp_exit()
923 if (!(t->t_proc_flag & TP_DAEMON) && in lwp_exit()
949 prlwpexit(t); /* notify /proc */ in lwp_exit()
950 if (!(t->t_proc_flag & TP_TWAIT) || (p->p_flag & SEXITLWPS)) in lwp_exit()
951 lwp_hash_out(p, t->t_tid); in lwp_exit()
953 ASSERT(!(t->t_proc_flag & TP_DAEMON)); in lwp_exit()
954 p->p_lwpdir[t->t_dslot].ld_entry->le_thread = NULL; in lwp_exit()
958 if (t->t_proc_flag & TP_DAEMON) { in lwp_exit()
960 t->t_proc_flag &= ~TP_DAEMON; in lwp_exit()
962 t->t_proc_flag &= ~TP_TWAIT; in lwp_exit()
973 CL_EXIT(t); /* tell the scheduler that t is exiting */ in lwp_exit()
985 t->t_proc_flag |= TP_LWPEXIT; in lwp_exit()
986 term_mstate(t); in lwp_exit()
990 if (t->t_tnf_tpdp) in lwp_exit()
994 t->t_forw->t_back = t->t_back; in lwp_exit()
995 t->t_back->t_forw = t->t_forw; in lwp_exit()
996 if (t == p->p_tlist) in lwp_exit()
997 p->p_tlist = t->t_forw; in lwp_exit()
1002 if (t->t_sigqueue != NULL) in lwp_exit()
1003 sigdelq(p, t, 0); in lwp_exit()
1018 thread_rele(t); in lwp_exit()
1024 t->t_preempt++; in lwp_exit()
1026 if (t->t_ctx != NULL) in lwp_exit()
1027 exitctx(t); in lwp_exit()
1031 t->t_procp = &p0; in lwp_exit()
1036 hat_thread_exit(t); in lwp_exit()
1045 if (--p->p_lwprcnt == 0 || (t->t_proc_flag & TP_HOLDLWP) || in lwp_exit()
1055 ASSERT(t != t->t_next); /* t0 never exits */ in lwp_exit()
1056 t->t_next->t_prev = t->t_prev; in lwp_exit()
1057 t->t_prev->t_next = t->t_next; in lwp_exit()
1058 cv_broadcast(&t->t_joincv); /* wake up anyone in thread_join */ in lwp_exit()
1061 t->t_state = TS_ZOMB; in lwp_exit()
1075 kthread_t *t = curthread; in lwp_cleanup() local
1076 proc_t *p = ttoproc(t); in lwp_cleanup()
1088 if (t == p->p_agenttp) { in lwp_cleanup()
1089 ASSERT(t->t_tid == p->p_lwpid); in lwp_cleanup()
1098 lgrp_move_thread(t, NULL, 1); in lwp_cleanup()
1099 if (t->t_tid == 1) { in lwp_cleanup()
1104 lwp_ctmpl_clear(ttolwp(t)); in lwp_cleanup()
1108 lwp_suspend(kthread_t *t) in lwp_suspend() argument
1111 proc_t *p = ttoproc(t); in lwp_suspend()
1120 t->t_proc_flag |= TP_HOLDLWP; in lwp_suspend()
1121 if (t == curthread) { in lwp_suspend()
1122 t->t_sig_check = 1; in lwp_suspend()
1127 thread_lock(t); in lwp_suspend()
1128 t->t_sig_check = 1; in lwp_suspend()
1133 if (ISWAKEABLE(t) || ISWAITING(t)) { in lwp_suspend()
1134 setrun_locked(t); in lwp_suspend()
1135 } else if (t->t_state == TS_ONPROC && t->t_cpu != CPU) { in lwp_suspend()
1136 poke_cpu(t->t_cpu->cpu_id); in lwp_suspend()
1139 tid = t->t_tid; /* remember thread ID */ in lwp_suspend()
1143 while (!SUSPENDED(t)) { in lwp_suspend()
1149 thread_unlock(t); in lwp_suspend()
1175 thread_lock(t); in lwp_suspend()
1181 if ((t->t_proc_flag & TP_HOLDLWP) == 0) { in lwp_suspend()
1182 thread_unlock(t); in lwp_suspend()
1186 thread_unlock(t); in lwp_suspend()
1195 lwp_continue(kthread_t *t) in lwp_continue() argument
1197 proc_t *p = ttoproc(t); in lwp_continue()
1198 int was_suspended = t->t_proc_flag & TP_HOLDLWP; in lwp_continue()
1202 t->t_proc_flag &= ~TP_HOLDLWP; in lwp_continue()
1203 thread_lock(t); in lwp_continue()
1204 if (SUSPENDED(t) && in lwp_continue()
1207 t->t_schedflag |= TS_CSTART; in lwp_continue()
1208 setrun_locked(t); in lwp_continue()
1210 thread_unlock(t); in lwp_continue()
1244 kthread_t *t = curthread; in holdlwp() local
1252 if ((p->p_flag & SEXITLWPS) || (t->t_proc_flag & TP_EXITLWP)) in holdlwp()
1443 kthread_t *t = curthread; in holdwatch() local
1484 t->t_proc_flag &= ~TP_WATCHSTOP; in holdwatch()
1518 t->t_proc_flag |= TP_WATCHSTOP; in holdwatch()
1523 t->t_proc_flag &= ~TP_WATCHSTOP; in holdwatch()
1535 t->t_proc_flag &= ~TP_WATCHSTOP; in holdwatch()
1554 ASSERT(t->t_proc_flag & TP_STOPPING); in holdwatch()
1569 kthread_t *t; in pokelwps() local
1573 t = p->p_tlist; in pokelwps()
1575 if (t == curthread) in pokelwps()
1577 thread_lock(t); in pokelwps()
1578 aston(t); /* make thread trap or do post_syscall */ in pokelwps()
1579 if (ISWAKEABLE(t) || ISWAITING(t)) { in pokelwps()
1580 setrun_locked(t); in pokelwps()
1581 } else if (t->t_state == TS_STOPPED) { in pokelwps()
1588 t->t_schedflag |= (TS_XSTART | TS_PSTART); in pokelwps()
1589 setrun_locked(t); in pokelwps()
1598 if ((p->p_flag & SHOLDFORK) && SUSPENDED(t)) { in pokelwps()
1599 if ((t->t_schedflag & TS_CSTART) == 0) { in pokelwps()
1601 t->t_schedflag |= TS_CSTART; in pokelwps()
1602 setrun_locked(t); in pokelwps()
1605 } else if (t->t_state == TS_ONPROC) { in pokelwps()
1606 if (t->t_cpu != CPU) in pokelwps()
1607 poke_cpu(t->t_cpu->cpu_id); in pokelwps()
1609 thread_unlock(t); in pokelwps()
1610 } while ((t = t->t_forw) != p->p_tlist); in pokelwps()
1619 kthread_t *t; in continuelwps() local
1633 t = p->p_tlist; in continuelwps()
1635 thread_lock(t); /* SUSPENDED looks at t_schedflag */ in continuelwps()
1636 if (SUSPENDED(t) && !(t->t_proc_flag & TP_HOLDLWP)) { in continuelwps()
1638 t->t_schedflag |= TS_CSTART; in continuelwps()
1639 setrun_locked(t); in continuelwps()
1641 thread_unlock(t); in continuelwps()
1642 } while ((t = t->t_forw) != p->p_tlist); in continuelwps()
1745 kthread_t *t; in exitlwps() local
1746 for (t = curthread->t_forw; --heldcnt > 0; t = t->t_forw) { in exitlwps()
1747 t->t_proc_flag &= ~TP_TWAIT; in exitlwps()
1748 lwp_continue(t); in exitlwps()
1802 kthread_t *t = lwptot(lwp); in forklwp() local
1811 ASSERT(t == curthread || (SUSPENDED(t) && lwp->lwp_asleep == 0)); in forklwp()
1814 if (t == curthread) in forklwp()
1818 if (t == curthread) in forklwp()
1823 NULL, 0, cp, TS_STOPPED, t->t_pri, &t->t_hold, NOCLASS, lwpid); in forklwp()
1860 ct->t_sysnum = t->t_sysnum; in forklwp()
1876 if (t->t_ctx) in forklwp()
1877 forkctx(t, ct); in forklwp()
1880 if (t->t_door) in forklwp()
1881 door_fork(t, ct); in forklwp()
1888 if (!(t->t_proc_flag & TP_HOLDLWP)) in forklwp()
1899 cid = t->t_cid; in forklwp()
1905 if (cid != t->t_cid) { in forklwp()
1916 ct->t_unpark = t->t_unpark; in forklwp()
1917 ct->t_clfuncs = t->t_clfuncs; in forklwp()
1918 CL_FORK(t, ct, bufp); in forklwp()
1919 ct->t_cid = t->t_cid; /* after data allocated so prgetpsinfo works */ in forklwp()
1935 kthread_t *t; in lwp_hash_in() local
1959 if ((t = lep->le_thread) != NULL) { in lwp_hash_in()
1960 ASSERT(lep->le_lwpid == t->t_tid); in lwp_hash_in()
1961 t->t_dslot = (int)(ldp - p->p_lwpdir); in lwp_hash_in()