SCHED_STATS_RUNQ_CHANGE(&rq->runq_stats, rq->count);
rq->count--;
if (queue_empty(queue)) {
- if (pri != IDLEPRI)
- clrbit(MAXPRI - pri, rq->bitmap);
- rq->highq = MAXPRI - ffsbit(rq->bitmap);
+ bitmap_clear(rq->bitmap, pri);
+ rq->highq = bitmap_first(rq->bitmap, NRQS);
}
simple_unlock(&global_runq_lock);
if (queue_empty(rq->queues + thread->sched_pri)) {
/* update run queue status */
- if (thread->sched_pri != IDLEPRI)
- clrbit(MAXPRI - thread->sched_pri, rq->bitmap);
- rq->highq = MAXPRI - ffsbit(rq->bitmap);
+ bitmap_clear(rq->bitmap, thread->sched_pri);
+ rq->highq = bitmap_first(rq->bitmap, NRQS);
}
thread->runq = PROCESSOR_NULL;
simple_lock(&global_runq_lock);
- if (gte)
+ if (global_runq->count == 0)
+ result = FALSE;
+ else if (gte)
result = global_runq->highq >= priority;
else
result = global_runq->highq >= priority;