/* cpu_policy_conf flags */
#define CPU_POLICY_ONE_THREAD_PER_CORE (1 << 0)
+#define CPU_POLICY_SET_IN_CONFIG (1 << 1)
/* cpu_policy_conf affinities */
#define CPU_AFFINITY_PER_GROUP (1 << 0)
int grp, thr;
int thr_count = 0;
- if (!global.numa_cpu_mapping)
+ if (!global.numa_cpu_mapping) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when numa-cpu-mapping is set.\n");
return 0;
+ }
- if (global.nbthread)
+ if (global.nbthread) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when nbthreads is set.\n");
return 0;
+ }
- if (cpu_mask_forced)
+ if (cpu_mask_forced) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy first-numa-node is ignored when CPUs were externally restricted.\n");
return 0;
+ }
/* determine first and second nodes with usable CPUs */
for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
int cid;
int div;
- if (global.nbthread)
+ if (global.nbthread) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when nbthreads is set.\n");
return 0;
+ }
- if (global.nbtgroups)
+ if (global.nbtgroups) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when thread-groups is set.\n");
return 0;
+ }
ha_cpuset_zero(&visited_cl_set);
int l3id;
int div;
- if (global.nbthread)
+ if (global.nbthread) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when nbthreads is set.\n");
return 0;
+ }
- if (global.nbtgroups)
+ if (global.nbtgroups) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when thread-groups is set.\n");
return 0;
+ }
ha_cpuset_zero(&visited_ccx_set);
int cpu, cluster;
int capa;
- if (global.nbthread || global.nbtgroups)
+ if (global.nbthread) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when nbthreads is set.\n");
+ return 0;
+ }
+
+ if (global.nbtgroups) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when thread-groups is set.\n");
return 0;
+ }
/* sort clusters by average reverse capacity */
cpu_cluster_reorder_by_avg_capa(ha_cpu_clusters, cpu_topo_maxcpus);
int cpu, cluster;
int capa;
- if (global.nbthread || global.nbtgroups)
+ if (global.nbthread) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when nbthreads is set.\n");
return 0;
+ }
+
+ if (global.nbtgroups) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when thread-groups is set.\n");
+ return 0;
+ }
/* sort clusters by average reverse capacity */
cpu_cluster_reorder_by_avg_capa(ha_cpu_clusters, cpu_topo_maxcpus);
int cpu, cluster;
int capa;
- if (global.nbthread || global.nbtgroups)
+ if (global.nbthread) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when nbthreads is set.\n");
return 0;
+ }
+
+ if (global.nbtgroups) {
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when thread-groups is set.\n");
+ return 0;
+ }
/* sort clusters by reverse capacity */
cpu_cluster_reorder_by_capa(ha_cpu_clusters, cpu_topo_maxcpus);
if (cpu_map_configured()) {
/* nothing to do */
+ if (cpu_policy_conf.flags & CPU_POLICY_SET_IN_CONFIG)
+ ha_notice("cpu-policy is ignored when cpu-map is set.\n");
return 0;
}
for (i = 0; ha_cpu_policy[i].name; i++) {
if (strcmp(args[1], ha_cpu_policy[i].name) == 0) {
cpu_policy_conf.cpu_policy = i;
+ cpu_policy_conf.flags |= CPU_POLICY_SET_IN_CONFIG;
return 0;
}
}