diff options
author | jeff <jeff@FreeBSD.org> | 2007-02-08 01:52:25 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2007-02-08 01:52:25 +0000 |
commit | 7038c5de35a55914aa33a5549087ae49459e9851 (patch) | |
tree | 5b2024b3921a74fef4f84c62d6f9acf1a4db0712 | |
parent | 35c8706625e7720b1707dfc5d8df700ac0503a57 (diff) | |
download | FreeBSD-src-7038c5de35a55914aa33a5549087ae49459e9851.zip FreeBSD-src-7038c5de35a55914aa33a5549087ae49459e9851.tar.gz |
- 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.
-rw-r--r-- | sys/kern/kern_switch.c | 10 | ||||
-rw-r--r-- | sys/kern/sched_ule.c | 8 | ||||
-rw-r--r-- | sys/sys/runq.h | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 13805ee..1ccf64c 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -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")); diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 5ddd415..4ed5216 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -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, diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 6e7e5d9..4b14e2d 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -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 |