change max_numa_node to max_numa_nodes option
This commit is contained in:
parent
d4f54dcf30
commit
bdb8274819
@ -275,7 +275,7 @@ typedef enum mi_option_e {
|
||||
mi_option_eager_commit_delay,
|
||||
mi_option_reset_delay,
|
||||
mi_option_os_tag,
|
||||
mi_option_max_numa_node,
|
||||
mi_option_max_numa_nodes,
|
||||
mi_option_max_errors,
|
||||
_mi_option_last
|
||||
} 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
|
||||
{ 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
|
||||
{ 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
|
||||
};
|
||||
|
||||
|
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) {
|
||||
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;
|
||||
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);
|
||||
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 ncount0 = ncount;
|
||||
// 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 <= 0) ncount = 1;
|
||||
_mi_numa_node_count = ncount;
|
||||
|
Loading…
x
Reference in New Issue
Block a user