Skip to content

Commit

Permalink
place work-stealing queue indices on different cache lines to avoid f…
Browse files Browse the repository at this point in the history
…alse-sharing
  • Loading branch information
d-netto committed Jan 22, 2024
1 parent 4d26be0 commit 1b21a32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/work-stealing-queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ static inline ws_array_t *create_ws_array(size_t capacity, int32_t eltsz) JL_NOT
return a;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc11-extensions"
typedef struct {
_Atomic(int64_t) top;
_Atomic(int64_t) bottom;
_Alignas(128) _Atomic(int64_t) bottom; // put on a separate cache line. conservatively estimate cache line size as 128 bytes
_Atomic(ws_array_t *) array;
} ws_queue_t;
#pragma GCC diagnostic pop

static inline ws_array_t *ws_queue_push(ws_queue_t *q, void *elt, int32_t eltsz) JL_NOTSAFEPOINT
{
Expand Down

0 comments on commit 1b21a32

Please sign in to comment.