From owner-svn-src-all@freebsd.org Fri Nov 25 17:20:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7EFEC54387; Fri, 25 Nov 2016 17:20:43 +0000 (UTC) (envelope-from fabient@freebsd.org) Received: from work.stormshield.eu (gwlille.netasq.com [91.212.116.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3F12D58; Fri, 25 Nov 2016 17:20:42 +0000 (UTC) (envelope-from fabient@freebsd.org) Received: from work.stormshield.eu (localhost [127.0.0.1]) by work.stormshield.eu (Postfix) with ESMTPS id B39C4376088E; Fri, 25 Nov 2016 18:13:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by work.stormshield.eu (Postfix) with ESMTP id A5EC63760882; Fri, 25 Nov 2016 18:13:30 +0100 (CET) Received: from work.stormshield.eu ([127.0.0.1]) by localhost (work.stormshield.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id H_aHapcOjKkP; Fri, 25 Nov 2016 18:13:30 +0100 (CET) Received: from deadbeef.netasq.com (unknown [91.212.116.2]) by work.stormshield.eu (Postfix) with ESMTPSA id 8DEAE3760376; Fri, 25 Nov 2016 18:13:30 +0100 (CET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r309143 - head/sys/libkern From: Fabien Thomas In-Reply-To: <20161125160010.GA3307@dft-labs.eu> Date: Fri, 25 Nov 2016 18:20:40 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <4E934AF1-62E7-4C85-80D0-50548AD4E696@freebsd.org> References: <201611251349.uAPDnX09042110@repo.freebsd.org> <20161125160010.GA3307@dft-labs.eu> To: Mateusz Guzik X-Mailer: Apple Mail (2.3251) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2016 17:20:43 -0000 > Le 25 nov. 2016 =C3=A0 17:00, Mateusz Guzik 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