Index: sys/kern/sched_ule.c =================================================================== --- sys/kern/sched_ule.c +++ sys/kern/sched_ule.c @@ -360,17 +360,18 @@ /* * We need some randomness. Implement the classic Linear Congruential * generator X_{n+1}=(aX_n+c) mod m. These values are optimized for - * m = 2^32, a = 69069 and c = 5. This is signed so that we can get - * both positive and negative values from it by shifting the value - * right. + * m = 2^32, a = 69069 and c = 5. */ -static int sched_random() +static uint32_t sched_random() { - int rnd, *rndptr; - rndptr = DPCPU_PTR(randomval); - rnd = *rndptr * 69069 + 5; - *rndptr = rnd; - return(rnd); + uint32_t *rndptr; + int rnd; + + rndptr = DPCPU_PTR(randomval); + *rndptr = *rndptr * 69069 + 5; + rnd = *rndptr; + + return (rnd); } #endif @@ -718,7 +719,7 @@ CPU_CLR(cpu, &cpumask); tdq = TDQ_CPU(cpu); load = tdq->tdq_load * 256; - rnd = sched_random() >> 26; /* -32 to +31 */ + rnd = sched_random() >> 26; if (match & CPU_SEARCH_LOWEST) { if (cpu == low->cs_prefer) load -= 64;