mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-04 22:49:32 +03:00
while at it, doing dragonflybsd too
This commit is contained in:
parent
fc7777ee8c
commit
2d2d9af5c6
1 changed files with 20 additions and 2 deletions
22
src/os.c
22
src/os.c
|
@ -51,13 +51,13 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#include <mach/vm_statistics.h>
|
#include <mach/vm_statistics.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#if __FreeBSD_version >= 1200000
|
#if __FreeBSD_version >= 1200000
|
||||||
#include <sys/cpuset.h>
|
#include <sys/cpuset.h>
|
||||||
#include <sys/domainset.h>
|
#include <sys/domainset.h>
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1267,6 +1267,24 @@ static size_t mi_os_numa_node_countx(void) {
|
||||||
|
|
||||||
return ndomains;
|
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.
|
||||||
|
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
|
#else
|
||||||
static size_t mi_os_numa_nodex(void) {
|
static size_t mi_os_numa_nodex(void) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue