MINOR: cpu-topo: pass an extra argument to ha_cpu_policy

This extra argument will allow common functions to distinguish between
multiple policies. For now it's not used.
This commit is contained in:
Willy Tarreau 2025-03-31 14:51:01 +02:00
parent e4053b0d09
commit 1e9a2529aa
2 changed files with 6 additions and 5 deletions

View File

@ -62,6 +62,7 @@ struct ha_cpu_policy {
const char *name; /* option name in the configuration */
const char *desc; /* short description for help messages */
int (*fct)(int policy, int tmin, int tmax, int gmin, int gmax, char **err);
int arg; /* optional arg for the function */
};
#endif /* _HAPROXY_CPU_TOPO_T_H */

View File

@ -59,11 +59,11 @@ static int cpu_policy_resource(int policy, int tmin, int tmax, int gmin, int gma
static struct ha_cpu_policy ha_cpu_policy[] = {
{ .name = "none", .desc = "use all available CPUs", .fct = NULL },
{ .name = "first-usable-node", .desc = "use only first usable node if nbthreads not set", .fct = cpu_policy_first_usable_node },
{ .name = "group-by-cluster", .desc = "make one thread group per core cluster", .fct = cpu_policy_group_by_cluster },
{ .name = "performance", .desc = "make one thread group per perf. core cluster", .fct = cpu_policy_performance },
{ .name = "efficiency", .desc = "make one thread group per eff. core cluster", .fct = cpu_policy_efficiency },
{ .name = "resource", .desc = "make one thread group from the smallest cluster", .fct = cpu_policy_resource },
{ .name = "first-usable-node", .desc = "use only first usable node if nbthreads not set", .fct = cpu_policy_first_usable_node, .arg = 0 },
{ .name = "group-by-cluster", .desc = "make one thread group per core cluster", .fct = cpu_policy_group_by_cluster , .arg = 1 },
{ .name = "performance", .desc = "make one thread group per perf. core cluster", .fct = cpu_policy_performance , .arg = 0 },
{ .name = "efficiency", .desc = "make one thread group per eff. core cluster", .fct = cpu_policy_efficiency , .arg = 0 },
{ .name = "resource", .desc = "make one thread group from the smallest cluster", .fct = cpu_policy_resource , .arg = 0 },
{ 0 } /* end */
};