From 66ebe1a874e18d978776cd3238ee3c422774475f Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sun, 27 Feb 2011 22:16:10 -0500 Subject: [PATCH] Drop usage of CK_CC_PACKED, prefer natural alignment. CK_CC_PACKED will drop structures to one-byte alignment in certain cases. Obviously, this will mean bad performance on most architectures. Thanks to Matt Johnson from https://rigel.crhc.illinois.edu/ for reporting this problem. --- include/ck_bytelock.h | 2 +- include/ck_fifo.h | 6 +++--- include/ck_ring.h | 2 +- include/ck_spinlock.h | 2 +- include/ck_stack.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/ck_bytelock.h b/include/ck_bytelock.h index 8b49684..470bd67 100644 --- a/include/ck_bytelock.h +++ b/include/ck_bytelock.h @@ -47,7 +47,7 @@ struct ck_bytelock { unsigned int owner; unsigned int n_readers; uint8_t readers[CK_MD_CACHELINE - sizeof(unsigned int) * 2] CK_CC_ALIGN(8); -} CK_CC_PACKED; +}; typedef struct ck_bytelock ck_bytelock_t; #define CK_BYTELOCK_INITIALIZER { 0, 0, {0} } diff --git a/include/ck_fifo.h b/include/ck_fifo.h index 78a9181..50b5b38 100644 --- a/include/ck_fifo.h +++ b/include/ck_fifo.h @@ -47,7 +47,7 @@ struct ck_fifo_spsc { struct ck_fifo_spsc_entry *tail; struct ck_fifo_spsc_entry *head_snapshot; struct ck_fifo_spsc_entry *garbage; -} CK_CC_PACKED; +}; typedef struct ck_fifo_spsc ck_fifo_spsc_t; CK_CC_INLINE static void @@ -139,7 +139,7 @@ ck_fifo_spsc_recycle(struct ck_fifo_spsc *fifo) struct ck_fifo_mpmc_entry; struct ck_fifo_mpmc_pointer { struct ck_fifo_mpmc_entry *pointer; - char *generation; + char *generation CK_CC_PACKED; } CK_CC_ALIGN(16); struct ck_fifo_mpmc_entry { @@ -154,7 +154,7 @@ struct ck_fifo_mpmc { struct ck_fifo_mpmc_pointer tail; struct ck_fifo_mpmc_entry *head_snapshot; struct ck_fifo_mpmc_pointer garbage; -} CK_CC_PACKED; +}; typedef struct ck_fifo_mpmc ck_fifo_mpmc_t; CK_CC_INLINE static void diff --git a/include/ck_ring.h b/include/ck_ring.h index ba8c091..e2c4b72 100644 --- a/include/ck_ring.h +++ b/include/ck_ring.h @@ -116,7 +116,7 @@ struct ck_ring { unsigned int size; unsigned int mask; void **ring; -} CK_CC_PACKED; +}; typedef struct ck_ring ck_ring_t; /* diff --git a/include/ck_spinlock.h b/include/ck_spinlock.h index e655a6f..5716bc1 100644 --- a/include/ck_spinlock.h +++ b/include/ck_spinlock.h @@ -351,7 +351,7 @@ ck_spinlock_dec_unlock(struct ck_spinlock_dec *lock) struct ck_spinlock_ticket { unsigned int next; unsigned int position; -} CK_CC_PACKED; +}; typedef struct ck_spinlock_ticket ck_spinlock_ticket_t; #define CK_SPINLOCK_TICKET_INITIALIZER {.next = 0, .position = 0} diff --git a/include/ck_stack.h b/include/ck_stack.h index 71bb8d6..f385604 100644 --- a/include/ck_stack.h +++ b/include/ck_stack.h @@ -40,8 +40,8 @@ typedef struct ck_stack_entry ck_stack_entry_t; struct ck_stack { struct ck_stack_entry *head; - char *generation; -} CK_CC_PACKED CK_CC_ALIGN(16); + char *generation CK_CC_PACKED; +}; typedef struct ck_stack ck_stack_t; #define CK_STACK_INITIALIZER { NULL, NULL }