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
This commit is contained in:
Mateusz Guzik 2021-11-03 21:11:59 +01:00
parent e469b16d0b
commit 84c048822e

View File

@ -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;