git: 8bb173fb5bc3 - main - sched_ule(4): Use trylock when stealing load.

Alexander Motin mav at FreeBSD.org
Mon Aug 2 03:47:38 UTC 2021


On 01.08.2021 23:43, Mateusz Guzik wrote:
> Mostly related, I just had a look at the code and noticed:
> 
> static uint32_t
> sched_random(void)
> {
>         uint32_t *rndptr;
> 
>         rndptr = DPCPU_PTR(randomval);
>         *rndptr = *rndptr * 69069 + 5;
> 
>         return (*rndptr >> 16);
> }
> 
> Except randomval starts at 0 for all CPUs. Should be easy to pre-init
> with an actual random value. Is that something you played with?

It is pretty old code, so no, at least not this time.  But I doubt it
would make a any difference, since different CPUs should have different
number of calls to this, so they should naturally run away from each-other.

-- 
Alexander Motin


More information about the dev-commits-src-main mailing list