mirror of
https://github.com/microsoft/mimalloc.git
synced 2024-12-30 23:43:39 +08:00
minor edits
This commit is contained in:
parent
4d8ba61a2d
commit
6ccf7e87c0
14
src/os.c
14
src/os.c
@ -1249,40 +1249,28 @@ static size_t mi_os_numa_nodex(void) {
|
||||
domainset_t dom;
|
||||
size_t node;
|
||||
int policy;
|
||||
|
||||
if (cpuset_getdomain(CPU_LEVEL_CPUSET, CPU_WHICH_PID, -1, sizeof(dom), &dom, &policy) == -1) return 0ul;
|
||||
|
||||
for (node = 0; node < MAXMEMDOM; node++) {
|
||||
if (DOMAINSET_ISSET(node, &dom)) return node;
|
||||
}
|
||||
|
||||
return 0ul;
|
||||
}
|
||||
|
||||
static size_t mi_os_numa_node_countx(void) {
|
||||
size_t ndomains = 0;
|
||||
size_t len = sizeof(ndomains);
|
||||
|
||||
if (sysctlbyname("vm.ndomains", &ndomains, &len, NULL, 0) == -1) return 0ul;
|
||||
|
||||
return ndomains;
|
||||
}
|
||||
#elif defined(__DragonFly__)
|
||||
static size_t mi_os_numa_nodex(void) {
|
||||
// TODO DragonFlyBSD does not seem to provide any userland mean to
|
||||
// check this information, even less the possibility to control
|
||||
// the allocation to a logical core level's granularity, only the kernel
|
||||
// is fully NUMA aware at the moment.
|
||||
// TODO: DragonFly does not seem to provide any userland means to get this information.
|
||||
return 0ul;
|
||||
}
|
||||
|
||||
static size_t mi_os_numa_node_countx(void) {
|
||||
size_t ncpus = 0, nvirtcoresperphys = 0;
|
||||
size_t len = sizeof(size_t);
|
||||
|
||||
if (sysctlbyname("hw.ncpu", &ncpus, &len, NULL, 0) == -1) return 0ul;
|
||||
if (sysctlbyname("hw.cpu_topology_ht_ids", &nvirtcoresperphys, &len, NULL, 0) == -1) return 0ul;
|
||||
|
||||
return nvirtcoresperphys * ncpus;
|
||||
}
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user