summaryrefslogtreecommitdiff
path: root/include/mimalloc-internal.h
diff options
context:
space:
mode:
authorDaan Leijen <daan@microsoft.com>2021-06-17 20:05:40 -0700
committerDaan Leijen <daan@microsoft.com>2021-06-17 20:05:40 -0700
commitb3b0fb58326a96beea1f4872bc1489d1d9fda7e0 (patch)
tree42406e6168718b9b91a9624e915795e9f1d4d2d0 /include/mimalloc-internal.h
parent5869c85749754ff2f29390846d0fc93ccbdf60e8 (diff)
parent752594e76423526e108413731518a26e3322b9ca (diff)
merge from dev
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r--include/mimalloc-internal.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h
index 48050a0..824f23c 100644
--- a/include/mimalloc-internal.h
+++ b/include/mimalloc-internal.h
@@ -799,13 +799,14 @@ static inline uintptr_t _mi_random_shuffle(uintptr_t x) {
int _mi_os_numa_node_get(mi_os_tld_t* tld);
size_t _mi_os_numa_node_count_get(void);
-extern size_t _mi_numa_node_count;
+extern _Atomic(size_t) _mi_numa_node_count;
static inline int _mi_os_numa_node(mi_os_tld_t* tld) {
- if (mi_likely(_mi_numa_node_count == 1)) return 0;
+ if (mi_likely(mi_atomic_load_relaxed(&_mi_numa_node_count) == 1)) return 0;
else return _mi_os_numa_node_get(tld);
}
static inline size_t _mi_os_numa_node_count(void) {
- if (mi_likely(_mi_numa_node_count>0)) return _mi_numa_node_count;
+ const size_t count = mi_atomic_load_relaxed(&_mi_numa_node_count);
+ if (mi_likely(count>0)) return count;
else return _mi_os_numa_node_count_get();
}