git: 84c048822ed9 - main - ipsec: make sure the lock allocated in key_newsav does not false-share
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 14 Nov 2021 20:17:47 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=84c048822ed9c897f92b1f052c6b89f1ed9f18f1 commit 84c048822ed9c897f92b1f052c6b89f1ed9f18f1 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2021-11-03 20:11:59 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> 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;