From: Willy Tarreau Date: Mon, 31 Mar 2025 12:51:01 +0000 (+0200) Subject: MINOR: cpu-topo: pass an extra argument to ha_cpu_policy X-Git-Tag: v3.2-dev9~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e9a2529aadf1b7e87e8558e94a28abd59c0fc03;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/haproxy/cpu_topo-t.h b/include/haproxy/cpu_topo-t.h index 4d85945eb..fa1e76720 100644 --- a/include/haproxy/cpu_topo-t.h +++ b/include/haproxy/cpu_topo-t.h @@ -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 */ diff --git a/src/cpu_topo.c b/src/cpu_topo.c index 8d9b0a7b8..14bf93e81 100644 --- a/src/cpu_topo.c +++ b/src/cpu_topo.c @@ -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 */ };