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