Skip to content

Commit

Permalink
include/ofi_atomic_queue: fix create function
Browse files Browse the repository at this point in the history
create function needs to align the allocation with the cache line size

Signed-off-by: Alexia Ingerson <alexia.ingerson@intel.com>
  • Loading branch information
aingerson committed Feb 21, 2025
1 parent 2f5e6d4 commit 5df45cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/ofi_atomic_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down

0 comments on commit 5df45cd

Please sign in to comment.