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.
ck_pring
Samy Al Bahra 14 years ago
parent 44643bd5f3
commit 66ebe1a874

@ -47,7 +47,7 @@ struct ck_bytelock {
unsigned int owner; unsigned int owner;
unsigned int n_readers; unsigned int n_readers;
uint8_t readers[CK_MD_CACHELINE - sizeof(unsigned int) * 2] CK_CC_ALIGN(8); uint8_t readers[CK_MD_CACHELINE - sizeof(unsigned int) * 2] CK_CC_ALIGN(8);
} CK_CC_PACKED; };
typedef struct ck_bytelock ck_bytelock_t; typedef struct ck_bytelock ck_bytelock_t;
#define CK_BYTELOCK_INITIALIZER { 0, 0, {0} } #define CK_BYTELOCK_INITIALIZER { 0, 0, {0} }

@ -47,7 +47,7 @@ struct ck_fifo_spsc {
struct ck_fifo_spsc_entry *tail; struct ck_fifo_spsc_entry *tail;
struct ck_fifo_spsc_entry *head_snapshot; struct ck_fifo_spsc_entry *head_snapshot;
struct ck_fifo_spsc_entry *garbage; struct ck_fifo_spsc_entry *garbage;
} CK_CC_PACKED; };
typedef struct ck_fifo_spsc ck_fifo_spsc_t; typedef struct ck_fifo_spsc ck_fifo_spsc_t;
CK_CC_INLINE static void 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_entry;
struct ck_fifo_mpmc_pointer { struct ck_fifo_mpmc_pointer {
struct ck_fifo_mpmc_entry *pointer; struct ck_fifo_mpmc_entry *pointer;
char *generation; char *generation CK_CC_PACKED;
} CK_CC_ALIGN(16); } CK_CC_ALIGN(16);
struct ck_fifo_mpmc_entry { struct ck_fifo_mpmc_entry {
@ -154,7 +154,7 @@ struct ck_fifo_mpmc {
struct ck_fifo_mpmc_pointer tail; struct ck_fifo_mpmc_pointer tail;
struct ck_fifo_mpmc_entry *head_snapshot; struct ck_fifo_mpmc_entry *head_snapshot;
struct ck_fifo_mpmc_pointer garbage; struct ck_fifo_mpmc_pointer garbage;
} CK_CC_PACKED; };
typedef struct ck_fifo_mpmc ck_fifo_mpmc_t; typedef struct ck_fifo_mpmc ck_fifo_mpmc_t;
CK_CC_INLINE static void CK_CC_INLINE static void

@ -116,7 +116,7 @@ struct ck_ring {
unsigned int size; unsigned int size;
unsigned int mask; unsigned int mask;
void **ring; void **ring;
} CK_CC_PACKED; };
typedef struct ck_ring ck_ring_t; typedef struct ck_ring ck_ring_t;
/* /*

@ -351,7 +351,7 @@ ck_spinlock_dec_unlock(struct ck_spinlock_dec *lock)
struct ck_spinlock_ticket { struct ck_spinlock_ticket {
unsigned int next; unsigned int next;
unsigned int position; unsigned int position;
} CK_CC_PACKED; };
typedef struct ck_spinlock_ticket ck_spinlock_ticket_t; typedef struct ck_spinlock_ticket ck_spinlock_ticket_t;
#define CK_SPINLOCK_TICKET_INITIALIZER {.next = 0, .position = 0} #define CK_SPINLOCK_TICKET_INITIALIZER {.next = 0, .position = 0}

@ -40,8 +40,8 @@ typedef struct ck_stack_entry ck_stack_entry_t;
struct ck_stack { struct ck_stack {
struct ck_stack_entry *head; struct ck_stack_entry *head;
char *generation; char *generation CK_CC_PACKED;
} CK_CC_PACKED CK_CC_ALIGN(16); };
typedef struct ck_stack ck_stack_t; typedef struct ck_stack ck_stack_t;
#define CK_STACK_INITIALIZER { NULL, NULL } #define CK_STACK_INITIALIZER { NULL, NULL }

Loading…
Cancel
Save