diff options
author | jeff <jeff@FreeBSD.org> | 2007-03-17 18:13:32 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2007-03-17 18:13:32 +0000 |
commit | 82143f95ad1b41e027bececf613c3e94f1556ac6 (patch) | |
tree | 1d35f7b518c30faa72f63d65c95381280adaf88d | |
parent | 1008dd40e3ccaea2037b43cebc74eb7310fccdd6 (diff) | |
download | FreeBSD-src-82143f95ad1b41e027bececf613c3e94f1556ac6.zip FreeBSD-src-82143f95ad1b41e027bececf613c3e94f1556ac6.tar.gz |
- Cast the intermediate value in priority computtion back down to
unsigned char. Weirdly, casting the 1 constant to u_char still produces
a signed integer result that is then used in the % computation. This
avoids that mess all together and causes a 0 pri to turn into 255 % 64
as we expect.
Reported by: kkenn (about 4 times, thanks)
-rw-r--r-- | sys/kern/sched_ule.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 2a62798..c7e94c7 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -388,7 +388,7 @@ tdq_runq_add(struct tdq *tdq, struct td_sched *ts, int flags) */ if (tdq->tdq_ridx != tdq->tdq_idx && pri == tdq->tdq_ridx) - pri = (pri - 1) % RQ_NQS; + pri = (unsigned char)(pri - 1) % RQ_NQS; } else pri = tdq->tdq_ridx; runq_add_pri(ts->ts_runq, ts, pri, flags); |