Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Nov 2016 18:20:40 +0100
From:      Fabien Thomas <fabient@freebsd.org>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r309143 - head/sys/libkern
Message-ID:  <4E934AF1-62E7-4C85-80D0-50548AD4E696@freebsd.org>
In-Reply-To: <20161125160010.GA3307@dft-labs.eu>
References:  <201611251349.uAPDnX09042110@repo.freebsd.org> <20161125160010.GA3307@dft-labs.eu>

next in thread | previous in thread | raw e-mail | index | archive | help

> Le 25 nov. 2016 =C3=A0 17:00, Mateusz Guzik <mjguzik@gmail.com> a =
=C3=A9crit :
>=20
> 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
>>=20
>> 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.
>>=20
>>  The idea of this patch is to split this mutex in order to reduce the
>>  contention on this lock.
>>=20
>> +MALLOC_DEFINE(M_ARC4RANDOM, "arc4random", "arc4random structures");
>>=20
>> -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;
>> +};
>> +
>=20
> Why is the lock at the end? Right now you got false sharing with the
> next entry.
>=20
> 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

>=20
> --=20
> Mateusz Guzik <mjguzik gmail.com>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4E934AF1-62E7-4C85-80D0-50548AD4E696>