> Le 25 nov. 2016 à 17:00, Mateusz Guzik <mjgu...@gmail.com> a écrit : > > On Fri, Nov 25, 2016 at 01:49:33PM +0000, Fabien Thomas wrote: >> Author: fabient >> Date: Fri Nov 25 13:49:33 2016 >> New Revision: 309143 >> URL: https://svnweb.freebsd.org/changeset/base/309143 >> >> Log: >> In a dual processor system (2*6 cores) during IPSec throughput tests, >> we see a lot of contention on the arc4 lock, used to generate the IV >> of the ESP output packets. >> >> The idea of this patch is to split this mutex in order to reduce the >> contention on this lock. >> >> +MALLOC_DEFINE(M_ARC4RANDOM, "arc4random", "arc4random structures"); >> >> -static u_int8_t arc4_randbyte(void); >> +struct arc4_s { >> + u_int8_t i, j; >> + int numruns; >> + u_int8_t sbox[256]; >> + time_t t_reseed; >> + >> + struct mtx mtx; >> +}; >> + > > Why is the lock at the end? Right now you got false sharing with the > next entry. > > That said, I suggest: > 1. moving thelock to the beginning > 2. annotating the struct with __aligned(CACHE_LINE_SIZE)
Yes good catch, it will be better that way. Committed as r309146. Thanks > > -- > Mateusz Guzik <mjguzik gmail.com> _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"