On Fri, Nov 25, 2016 at 01:49:33PM +0000, Fabien Thomas wrote:
> + if (reseed || atomic_cmpset_int(&arc4rand_iniseed_state,
> + ARC4_ENTR_HAVE, ARC4_ENTR_SEED)) {
> + ARC4_FOREACH(arc4)
> + arc4_randomstir(arc4);
> + }
How about eliminating this atomic? Converting it to:
if (reseed || arc4rand_iniseed_state == ARC4_ENTR_HAVE) {
arc4rand_iniseed_state = ARC4_ENTR_SEED;
ARC4_FOREACH(arc4);
arc4_randomstir(arc4);
}
should give you free performance boost. Having locked cmpxchg in main path is
not cheap (and as i can see it's really used only once,
when randomdev unblocks).
P.S. quick and dirty test gives me 10-30% of extra perfomance.
--
Oleg.
================================================================
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- [email protected] ===
================================================================
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"