- Change types for necent runq additions to u_char rather than int.

- Fix these types in ULE as well.  This fixes bugs in priority index
   calculations in certain edge cases. (int)-1 % 64 != (uint)-1 % 64.

Reported by:	kkenn using pho's stress2.
This commit is contained in:
Jeff Roberson 2007-02-08 01:52:25 +00:00
parent c16a08dd67
commit ed0e8f2fe9
3 changed files with 12 additions and 12 deletions

View File

@ -306,7 +306,7 @@ runq_findbit(struct runq *rq)
}
static __inline int
runq_findbit_from(struct runq *rq, int start)
runq_findbit_from(struct runq *rq, u_char start)
{
struct rqbits *rqb;
int bit;
@ -388,7 +388,7 @@ runq_add(struct runq *rq, struct td_sched *ts, int flags)
}
void
runq_add_pri(struct runq *rq, struct td_sched *ts, int pri, int flags)
runq_add_pri(struct runq *rq, struct td_sched *ts, u_char pri, int flags)
{
struct rqhead *rqh;
@ -478,7 +478,7 @@ runq_choose(struct runq *rq)
}
struct td_sched *
runq_choose_from(struct runq *rq, int idx)
runq_choose_from(struct runq *rq, u_char idx)
{
struct rqhead *rqh;
struct td_sched *ts;
@ -511,10 +511,10 @@ runq_remove(struct runq *rq, struct td_sched *ts)
}
void
runq_remove_idx(struct runq *rq, struct td_sched *ts, int *idx)
runq_remove_idx(struct runq *rq, struct td_sched *ts, u_char *idx)
{
struct rqhead *rqh;
int pri;
u_char pri;
KASSERT(ts->ts_thread->td_proc->p_sflag & PS_INMEM,
("runq_remove_idx: process swapped out"));

View File

@ -178,10 +178,10 @@ struct tdq {
struct runq tdq_idle; /* Queue of IDLE threads. */
struct runq tdq_timeshare; /* timeshare run queue. */
struct runq tdq_realtime; /* real-time run queue. */
int tdq_idx; /* Current insert index. */
int tdq_ridx; /* Current removal index. */
u_char tdq_idx; /* Current insert index. */
u_char tdq_ridx; /* Current removal index. */
short tdq_flags; /* Thread queue flags */
int tdq_load; /* Aggregate load. */
int tdq_flags; /* Thread queue flags */
#ifdef SMP
int tdq_transferable;
LIST_ENTRY(tdq) tdq_siblings; /* Next in tdq group. */
@ -368,7 +368,7 @@ tdq_runq_add(struct tdq *tdq, struct td_sched *ts, int flags)
}
#endif
if (ts->ts_runq == &tdq->tdq_timeshare) {
int pri;
u_char pri;
pri = ts->ts_thread->td_priority;
KASSERT(pri <= PRI_MAX_TIMESHARE && pri >= PRI_MIN_TIMESHARE,

View File

@ -63,12 +63,12 @@ struct runq {
};
void runq_add(struct runq *, struct td_sched *, int);
void runq_add_pri(struct runq *, struct td_sched *, int, int);
void runq_add_pri(struct runq *, struct td_sched *, u_char, int);
int runq_check(struct runq *);
struct td_sched *runq_choose(struct runq *);
struct td_sched *runq_choose_from(struct runq *, int);
struct td_sched *runq_choose_from(struct runq *, u_char);
void runq_init(struct runq *);
void runq_remove(struct runq *, struct td_sched *);
void runq_remove_idx(struct runq *, struct td_sched *, int *);
void runq_remove_idx(struct runq *, struct td_sched *, u_char *);
#endif