/* node numbers to accept / reject */
struct hap_cpuset only_nodes;
struct hap_cpuset drop_nodes;
+ /* thread numbers to accept / reject */
+ struct hap_cpuset only_threads;
+ struct hap_cpuset drop_threads;
} cpu_set_cfg;
/* Detects CPUs that are online on the system. It may rely on FS access (e.g.
!ha_cpuset_isset(&cpu_set_cfg.only_nodes, ha_cpu_topo[cpu].no_id))
ha_cpu_topo[cpu].st |= HA_CPU_F_DONT_USE;
}
+
+ /* remove CPUs in the drop-thread set or not in the only-thread set */
+ for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
+ if ( ha_cpuset_isset(&cpu_set_cfg.drop_threads, ha_cpu_topo[cpu].th_id) ||
+ !ha_cpuset_isset(&cpu_set_cfg.only_threads, ha_cpu_topo[cpu].th_id))
+ ha_cpu_topo[cpu].st |= HA_CPU_F_DONT_USE;
+ }
}
/* CPU topology detection below, OS-specific */
ha_cpuset_and(&cpu_set_cfg.only_nodes, &tmp_cpuset);
arg++;
}
+ else if (strcmp(args[arg], "drop-thread") == 0 || strcmp(args[arg], "only-thread") == 0) {
+ if (!*args[arg + 1]) {
+ memprintf(err, "missing thread set");
+ goto parse_err;
+ }
+
+ cpu_set_str[0] = args[arg + 1];
+ if (parse_cpu_set(cpu_set_str, &tmp_cpuset, err) != 0)
+ goto parse_err;
+
+ if (*args[arg] == 'd') // threads to drop
+ ha_cpuset_or(&cpu_set_cfg.drop_threads, &tmp_cpuset);
+ else // threads to keep
+ ha_cpuset_and(&cpu_set_cfg.only_threads, &tmp_cpuset);
+ arg++;
+ }
else {
/* fall back with default error message */
memprintf(err, "'%s' passed an unknown directive '%s'", args[0], args[arg]);
leave_with_err:
/* complete with supported directives */
- memprintf(err, "%s (only 'reset', 'only-cpu', 'drop-cpu', 'only-node', 'drop-node' supported).", *err);
+ memprintf(err, "%s (only 'reset', 'only-cpu', 'drop-cpu', 'only-node', 'drop-node', 'only-thread', 'drop-thread' supported).", *err);
leave:
return -1;
}
ha_cpuset_zero(&cpu_set_cfg.only_cpus);
ha_cpuset_zero(&cpu_set_cfg.drop_nodes);
ha_cpuset_zero(&cpu_set_cfg.only_nodes);
+ ha_cpuset_zero(&cpu_set_cfg.drop_threads);
+ ha_cpuset_zero(&cpu_set_cfg.only_threads);
/* preset all CPUs in the "only-XXX" sets */
for (cpu = 0; cpu < cpu_topo_maxcpus; cpu++) {
ha_cpuset_set(&cpu_set_cfg.only_cpus, cpu);
ha_cpuset_set(&cpu_set_cfg.only_nodes, cpu);
+ ha_cpuset_set(&cpu_set_cfg.only_threads, cpu);
}
return 1;