MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sched_random

Function sched_random

freebsd/kern/sched_ule.c:622–631  ·  view source on GitHub ↗

* We need some randomness. Implement a 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. We only return the upper 16 bits * of the random state (in the low bits of our answer) to keep * the maximum randomness. */

Source from the content-addressed store, hash-verified

620 * the maximum randomness.
621 */
622static uint32_t
623sched_random(void)
624{
625 uint32_t *rndptr;
626
627 rndptr = DPCPU_PTR(randomval);
628 *rndptr = *rndptr * 69069 + 5;
629
630 return (*rndptr >> 16);
631}
632
633struct cpu_search {
634 cpuset_t cs_mask;

Callers 2

cpu_searchFunction · 0.85
sched_balanceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected