MINOR: cfgparse: move the binding detection into numa_detect_topology()
For now the function refrains from detecting the CPU topology when a restrictive taskset or cpu-map was already performed on the process, and it's documented as such, the reason being that until we're able to automatically create groups, better not change user settings. But we'll need to be able to detect bound CPUs and to process them as desired by the user, so we now need to move that detection into the function itself. It changes nothing to the logic, just gives more freedom to the function.
This commit is contained in:
parent
ac1db9db7d
commit
1560827c9d
@ -2743,8 +2743,8 @@ static int numa_filter(const struct dirent *dir)
|
||||
*/
|
||||
static int numa_detect_topology()
|
||||
{
|
||||
struct dirent **node_dirlist;
|
||||
int node_dirlist_size;
|
||||
struct dirent **node_dirlist = NULL;
|
||||
int node_dirlist_size = 0;
|
||||
|
||||
struct hap_cpuset active_cpus, node_cpu_set;
|
||||
const char *parse_cpu_set_args[2];
|
||||
@ -2754,6 +2754,10 @@ static int numa_detect_topology()
|
||||
/* node_cpu_set count is used as return value */
|
||||
ha_cpuset_zero(&node_cpu_set);
|
||||
|
||||
/* let's ignore restricted affinity */
|
||||
if (cpu_mask_forced || cpu_map_configured())
|
||||
goto free_scandir_entries;
|
||||
|
||||
/* 1. count the sysfs node<X> directories */
|
||||
node_dirlist = NULL;
|
||||
node_dirlist_size = scandir(NUMA_DETECT_SYSTEM_SYSFS_PATH"/node", &node_dirlist, numa_filter, alphasort);
|
||||
@ -2819,14 +2823,18 @@ static int numa_detect_topology()
|
||||
size_t len = sizeof(ndomains);
|
||||
int grp, thr;
|
||||
|
||||
ha_cpuset_zero(&node_cpu_set);
|
||||
|
||||
/* let's ignore restricted affinity */
|
||||
if (cpu_mask_forced || cpu_map_configured())
|
||||
goto leave;
|
||||
|
||||
if (sysctlbyname("vm.ndomains", &ndomains, &len, NULL, 0) == -1) {
|
||||
ha_notice("Cannot assess the number of CPUs domains\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BUG_ON(ndomains > MAXMEMDOM);
|
||||
ha_cpuset_zero(&node_cpu_set);
|
||||
|
||||
if (ndomains < 2)
|
||||
goto leave;
|
||||
|
||||
@ -2922,7 +2930,7 @@ int check_config_validity()
|
||||
{
|
||||
int numa_cores = 0;
|
||||
#if defined(USE_CPU_AFFINITY)
|
||||
if (global.numa_cpu_mapping && !cpu_mask_forced && !cpu_map_configured())
|
||||
if (global.numa_cpu_mapping)
|
||||
numa_cores = numa_detect_topology();
|
||||
#endif
|
||||
global.nbthread = numa_cores ? numa_cores :
|
||||
|
Loading…
x
Reference in New Issue
Block a user