rem: } else if (t->t_pri < t->t_disp_queue->disp_maxrunpri) {
add: } else if (t->t_state == TS_ONPROC && t->t_pri < t->t_disp_queue->disp_maxrunpri) {
context: fx_tick(kthread_t *t){	fxproc_t *fxpp;	ASSERT(MUTEX_HELD(&(ttoproc(t))->p_lock));	thread_lock(t);	fxpp = (fxproc_t *)(t->t_cldata);	if (FX_HAS_CB(fxpp)) {		clock_t new_quantum =  (clock_t)fxpp->fx_pquantum;		pri_t	newpri = fxpp->fx_pri;		FX_CB_TICK(FX_CALLB(fxpp), fxpp->fx_cookie,			&new_quantum, &newpri);		FX_ADJUST_QUANTUM(new_quantum);		if ((int)new_quantum != fxpp->fx_pquantum) {			fxpp->fx_pquantum = (int)new_quantum;			fxpp->fx_timeleft = fxpp->fx_pquantum;		}		FX_ADJUST_PRI(newpri);		if (newpri != fxpp->fx_pri) {			fxpp->fx_pri = newpri;			fx_change_priority(t, fxpp);		}	}	if ((fxpp->fx_pquantum != FX_TQINF) &&	    (--fxpp->fx_timeleft <= 0)) {		pri_t	new_pri;		/*		 * If we're doing preemption control and trying to		 * avoid preempting this thread, just note that		 * the thread should yield soon and let it keep		 * running (unless it's been a while).		 */		if (t->t_schedctl && schedctl_get_nopreempt(t)) {			if (fxpp->fx_timeleft > -SC_MAX_TICKS) {				DTRACE_SCHED1(schedctl__nopreempt,				    kthread_t *, t);				schedctl_set_yield(t, 1);				thread_unlock_nopreempt(t);				return;			}			TNF_PROBE_2(schedctl_failsafe,			    "schedctl FX fx_tick", /* CSTYLED */,			    tnf_pid, pid, ttoproc(t)->p_pid,			    tnf_lwpid, lwpid, t->t_tid);		}		new_pri = fx_dptbl[fxpp->fx_pri].fx_globpri;		ASSERT(new_pri >= 0 && new_pri <= fx_maxglobpri);		/*		 * When the priority of a thread is changed,		 * it may be necessary to adjust its position		 * on a sleep queue or dispatch queue. Even		 * when the priority is not changed, we need		 * to preserve round robin on dispatch queue.		 * The function thread_change_pri accomplishes		 * this.		 */		if (thread_change_pri(t, new_pri, 0)) {			fxpp->fx_timeleft = fxpp->fx_pquantum;		} else {			fxpp->fx_flags |= FXBACKQ;			cpu_surrender(t);		}	} else if (t->t_pri < t->t_disp_queue->disp_maxrunpri) {		fxpp->fx_flags |= FXBACKQ;		cpu_surrender(t);	}	thread_unlock_nopreempt(t);	/* clock thread can't be preempted */}