mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 06:59:32 +03:00
change max_numa_node to max_numa_nodes option
This commit is contained in:
parent
d4f54dcf30
commit
bdb8274819
3 changed files with 6 additions and 5 deletions
|
@ -275,7 +275,7 @@ typedef enum mi_option_e {
|
||||||
mi_option_eager_commit_delay,
|
mi_option_eager_commit_delay,
|
||||||
mi_option_reset_delay,
|
mi_option_reset_delay,
|
||||||
mi_option_os_tag,
|
mi_option_os_tag,
|
||||||
mi_option_max_numa_node,
|
mi_option_max_numa_nodes,
|
||||||
mi_option_max_errors,
|
mi_option_max_errors,
|
||||||
_mi_option_last
|
_mi_option_last
|
||||||
} mi_option_t;
|
} mi_option_t;
|
||||||
|
|
|
@ -70,7 +70,7 @@ static mi_option_desc_t options[_mi_option_last] =
|
||||||
{ 0, UNINIT, MI_OPTION(eager_commit_delay) }, // the first N segments per thread are not eagerly committed
|
{ 0, UNINIT, MI_OPTION(eager_commit_delay) }, // the first N segments per thread are not eagerly committed
|
||||||
{ 500, UNINIT, MI_OPTION(reset_delay) }, // reset delay in milli-seconds
|
{ 500, UNINIT, MI_OPTION(reset_delay) }, // reset delay in milli-seconds
|
||||||
{ 100, UNINIT, MI_OPTION(os_tag) }, // only apple specific for now but might serve more or less related purpose
|
{ 100, UNINIT, MI_OPTION(os_tag) }, // only apple specific for now but might serve more or less related purpose
|
||||||
{ 256, UNINIT, MI_OPTION(max_numa_node) }, // maximum allowed numa node
|
{ 256, UNINIT, MI_OPTION(max_numa_nodes) }, // use at most N numa nodes
|
||||||
{ 16, UNINIT, MI_OPTION(max_errors) } // maximum errors that are output
|
{ 16, UNINIT, MI_OPTION(max_errors) } // maximum errors that are output
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
7
src/os.c
7
src/os.c
|
@ -998,9 +998,10 @@ static int mi_os_numa_nodex(void) {
|
||||||
}
|
}
|
||||||
static int mi_os_numa_node_countx(void) {
|
static int mi_os_numa_node_countx(void) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int max_node = mi_option_get(mi_option_max_numa_node);
|
int max_nodes = mi_option_get(mi_option_max_numa_nodes); // set to 0 to disable detection (and NUMA awareness)
|
||||||
int node = 0;
|
int node = 0;
|
||||||
for(node = 0; node < max_node; node++) {
|
for(node = 0; node < max_nodes; node++) {
|
||||||
|
// enumerate node entries -- todo: it there a more efficient way to do this? (but ensure there is no allocation)
|
||||||
snprintf(buf, 127, "/sys/devices/system/node/node%i", node + 1);
|
snprintf(buf, 127, "/sys/devices/system/node/node%i", node + 1);
|
||||||
if (access(buf,R_OK) != 0) break;
|
if (access(buf,R_OK) != 0) break;
|
||||||
}
|
}
|
||||||
|
@ -1022,7 +1023,7 @@ int _mi_os_numa_node_count_get(void) {
|
||||||
int ncount = mi_os_numa_node_countx();
|
int ncount = mi_os_numa_node_countx();
|
||||||
int ncount0 = ncount;
|
int ncount0 = ncount;
|
||||||
// never more than max numa node and at least 1
|
// never more than max numa node and at least 1
|
||||||
int nmax = 1 + (int)mi_option_get(mi_option_max_numa_node);
|
int nmax = (int)mi_option_get(mi_option_max_numa_nodes);
|
||||||
if (ncount > nmax) ncount = nmax;
|
if (ncount > nmax) ncount = nmax;
|
||||||
if (ncount <= 0) ncount = 1;
|
if (ncount <= 0) ncount = 1;
|
||||||
_mi_numa_node_count = ncount;
|
_mi_numa_node_count = ncount;
|
||||||
|
|
Loading…
Add table
Reference in a new issue