]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cpu-topo: pass an extra argument to ha_cpu_policy
authorWilly Tarreau <w@1wt.eu>
Mon, 31 Mar 2025 12:51:01 +0000 (14:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 31 Mar 2025 14:21:37 +0000 (16:21 +0200)
This extra argument will allow common functions to distinguish between
multiple policies. For now it's not used.

include/haproxy/cpu_topo-t.h
src/cpu_topo.c

index 4d85945eb4bd4dfe9d1aeb130c1d55f9b10cc0e4..fa1e76720f8146a65f241aa61499c409aa5b8a8e 100644 (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 */
index 8d9b0a7b890f9e6d01a939215744762065a65c4b..14bf93e81fbeb0966ff8c25f6d57ac69e616409a 100644 (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 */
 };