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: fss_tick(kthread_t *t){	fssproc_t *fssproc;	fssproj_t *fssproj;	klwp_t *lwp;	ASSERT(MUTEX_HELD(&(ttoproc(t))->p_lock));	/*	 * It's safe to access fsspset and fssproj structures because we're	 * holding our p_lock here.	 */	thread_lock(t);	fssproc = FSSPROC(t);	fssproj = FSSPROC2FSSPROJ(fssproc);	if (fssproj != NULL) {		fsspset_t *fsspset = FSSPROJ2FSSPSET(fssproj);		disp_lock_enter_high(&fsspset->fssps_displock);		fssproj->fssp_ticks += fss_nice_tick[fssproc->fss_nice];		fssproc->fss_ticks++;		disp_lock_exit_high(&fsspset->fssps_displock);	}	/*	 * A thread's execution time for threads running in the SYS class	 * is not tracked.	 */	if ((fssproc->fss_flags & FSSKPRI) == 0) {		/*		 * If thread is not in kernel mode, decrement its fss_timeleft		 */		if (--fssproc->fss_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 (fssproc->fss_timeleft > -SC_MAX_TICKS) {					DTRACE_SCHED1(schedctl__nopreempt,					    kthread_t *, t);					schedctl_set_yield(t, 1);					thread_unlock_nopreempt(t);					return;				}			}			fss_newpri(fssproc);			new_pri = fssproc->fss_umdpri;			ASSERT(new_pri >= 0 && new_pri <= fss_maxglobpri);			/*			 * When the priority of a thread is changed, it may			 * be necessary to adjust its position on a sleep queue			 * or dispatch queue. The function thread_change_pri			 * accomplishes this.			 */			if (thread_change_pri(t, new_pri, 0)) {				if ((t->t_schedflag & TS_LOAD) &&				    (lwp = t->t_lwp) &&				    lwp->lwp_state == LWP_USER)					t->t_schedflag &= ~TS_DONT_SWAP;				fssproc->fss_timeleft = fss_quantum;			} else {				fssproc->fss_flags |= FSSBACKQ;				cpu_surrender(t);			}		} else if (t->t_pri < t->t_disp_queue->disp_maxrunpri) {			/*			 * If there is a higher-priority thread which is			 * waiting for a processor, then thread surrenders			 * the processor.			 */			fssproc->fss_flags |= FSSBACKQ;			cpu_surrender(t);		}	}	thread_unlock_nopreempt(t);	/* clock thread can't be preempted */}