We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8662728 commit 60daa68Copy full SHA for 60daa68
1 file changed
Python/qsbr.c
@@ -88,12 +88,13 @@ grow_thread_array(struct _qsbr_shared *shared)
88
// Overallocate by 63 bytes so we can align to a 64-byte boundary.
89
// This avoids potential false sharing between the first entry and other
90
// allocations.
91
- size_t alloc_size = (size_t)new_size * sizeof(struct _qsbr_pad) + 63;
+ size_t alignment = 64;
92
+ size_t alloc_size = (size_t)new_size * sizeof(struct _qsbr_pad) + alignment - 1;
93
void *raw = PyMem_RawCalloc(1, alloc_size);
94
if (raw == NULL) {
- return -1;
95
- }
96
- struct _qsbr_pad *array = _Py_ALIGN_UP(raw, 64);
+return -1;
+}
97
+ struct _qsbr_pad *array = _Py_ALIGN_UP(raw, alignment);
98
99
void *old_raw = shared->array_raw;
100
if (shared->array != NULL) {
0 commit comments