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 21, 2024
1 parent a9e2bd4 commit f59e7bd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/work-stealing-queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ static inline ws_array_t *create_ws_array(size_t capacity, int32_t eltsz) JL_NOT

typedef struct {
_Atomic(int64_t) top;
// put `top` and `bottom` on different cache lines
// to avoid false sharing
#ifdef _P64
void *_ignore[7];
#else
void *_ignore[15];
#endif
_Atomic(int64_t) bottom;
_Atomic(ws_array_t *) array;
} ws_queue_t;
Expand Down

0 comments on commit f59e7bd

Please sign in to comment.