From nobody Sun Nov 14 20:17:47 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4A060184D8C7; Sun, 14 Nov 2021 20:17:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HskCJ19Jqz3jS3; Sun, 14 Nov 2021 20:17:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00BB94C8B; Sun, 14 Nov 2021 20:17:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AEKHlnU082372; Sun, 14 Nov 2021 20:17:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AEKHl8Z082371; Sun, 14 Nov 2021 20:17:47 GMT (envelope-from git) Date: Sun, 14 Nov 2021 20:17:47 GMT Message-Id: <202111142017.1AEKHl8Z082371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 84c048822ed9 - main - ipsec: make sure the lock allocated in key_newsav does not false-share List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84c048822ed9c897f92b1f052c6b89f1ed9f18f1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=84c048822ed9c897f92b1f052c6b89f1ed9f18f1 commit 84c048822ed9c897f92b1f052c6b89f1ed9f18f1 Author: Mateusz Guzik AuthorDate: 2021-11-03 20:11:59 +0000 Commit: Mateusz Guzik CommitDate: 2021-11-14 20:17:35 +0000 ipsec: make sure the lock allocated in key_newsav does not false-share Reviewed by: ae Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32828 --- sys/netipsec/key.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index e2e1d76911ec..cd2f8a4ccafa 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -2961,8 +2961,8 @@ key_newsav(const struct sadb_msghdr *mhp, struct secasindex *saidx, *errp = ENOBUFS; goto done; } - sav->lock = malloc(sizeof(struct mtx), M_IPSEC_MISC, - M_NOWAIT | M_ZERO); + sav->lock = malloc_aligned(max(sizeof(struct mtx), CACHE_LINE_SIZE), + CACHE_LINE_SIZE, M_IPSEC_MISC, M_NOWAIT | M_ZERO); if (sav->lock == NULL) { *errp = ENOBUFS; goto done;