From 5df45cddefcdfe2f6798963aa86c66567cb25f39 Mon Sep 17 00:00:00 2001 From: Alexia Ingerson Date: Wed, 12 Feb 2025 14:00:46 -0800 Subject: [PATCH] include/ofi_atomic_queue: fix create function create function needs to align the allocation with the cache line size Signed-off-by: Alexia Ingerson --- include/ofi_atomic_queue.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/ofi_atomic_queue.h b/include/ofi_atomic_queue.h index 9d5eb70de6e..0f6afbc005f 100644 --- a/include/ofi_atomic_queue.h +++ b/include/ofi_atomic_queue.h @@ -135,9 +135,10 @@ static inline void name ## _init(struct name *aq, size_t size) \ static inline struct name * name ## _create(size_t size) \ { \ struct name *aq; \ - aq = (struct name*) calloc(1, sizeof(*aq) + \ - sizeof(struct name ## _entry) * \ - (roundup_power_of_two(size))); \ + aq = (struct name *) aligned_alloc( \ + OFI_CACHE_LINE_SIZE, sizeof(*aq) + \ + sizeof(struct name ## _entry) * \ + (roundup_power_of_two(size))); \ if (aq) \ name ##_init(aq, roundup_power_of_two(size)); \ return aq; \