Skip to content

Commit 48ec09c

Browse files
committed
place work-stealing queue indices on different cache lines to avoid false-sharing
1 parent 47d31ac commit 48ec09c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/work-stealing-queue.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ static inline ws_array_t *create_ws_array(size_t capacity, int32_t eltsz) JL_NOT
3636

3737
typedef struct {
3838
_Atomic(int64_t) top;
39+
// put `top` and `bottom` on different cache lines
40+
// to avoid false sharing
41+
#ifdef _P64
42+
void *_ignore[7];
43+
#else
44+
void *_ignore[15];
45+
#endif
3946
_Atomic(int64_t) bottom;
4047
_Atomic(ws_array_t *) array;
4148
} ws_queue_t;

0 commit comments

Comments
 (0)