]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
random(4): depessimize arc4random
authormjg <mjg@FreeBSD.org>
Sun, 12 May 2019 06:32:46 +0000 (06:32 +0000)
committermjg <mjg@FreeBSD.org>
Sun, 12 May 2019 06:32:46 +0000 (06:32 +0000)
commit95034c44e6ba9e5e2532353b5cac1ad714817f47
tree85f1f2d000e98fe8165d0a405adc50c4ab0b28ee
parent947c94708107c0e0cb86743a7db47e705466fb2f
random(4): depessimize arc4random

- __predict_false reseeding on entry as it is almost never true.
- don't blindly atomic_cmpset as on x86 it ends up dirtying the cacheline.
it almost ever succeeds per above
- fetch the timestamp prior to getting the cpu number

Reviewed by: cem
Approved by: secteam (delphij)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20242
sys/libkern/arc4random.c