git: 25e0e25afd29 - stable/14 - uma: Permit specifying max of cache line and some custom alignment
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Nov 2023 20:54:46 UTC
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=25e0e25afd29d029da6ec21e6b7890310ffc25bd commit 25e0e25afd29d029da6ec21e6b7890310ffc25bd Author: Olivier Certner <olce.freebsd@certner.fr> AuthorDate: 2023-10-13 15:05:34 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-11-16 15:07:18 +0000 uma: Permit specifying max of cache line and some custom alignment To be used for structures for which we want to enforce that pointers to them have some number of lower bits always set to 0, while still ensuring we benefit from cache line alignment to avoid false sharing between structures and fields within the structures (provided they are properly ordered). First candidate consumer that comes to mind is 'struct thread', see next commit. Reviewed by: markj, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42265 (cherry picked from commit 733e0abd2897289e2acf70f7c72e31a5a560394a) --- sys/vm/uma.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/vm/uma.h b/sys/vm/uma.h index 8193df16b904..38865df7ae02 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -302,6 +302,8 @@ uma_zone_t uma_zcache_create(const char *name, int size, uma_ctor ctor, #define UMA_ALIGN_SHORT (sizeof(short) - 1) /* "" short */ #define UMA_ALIGN_CHAR (sizeof(char) - 1) /* "" char */ #define UMA_ALIGN_CACHE (uma_get_cache_align_mask()) /* Cache line size align */ +/* Align both to cache line size and an explicit alignment (through mask). */ +#define UMA_ALIGN_CACHE_AND_MASK(mask) (uma_get_cache_align_mask() | (mask)) #define UMA_ALIGNOF(type) (_Alignof(type) - 1) /* Alignment fit for 'type' */ #define UMA_ANYDOMAIN -1 /* Special value for domain search. */