diff --git a/doc/configuration.txt b/doc/configuration.txt index 7926b72ef..1998dab6c 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -1332,7 +1332,7 @@ cluster-secret startup. This allows to use features which rely on it, albeit with some limitations. -cpu-map [auto:][/] ... +cpu-map [auto:][/] [,...] [...] On some operating systems, it is possible to bind a thread group or a thread to a specific CPU set. This means that the designated threads will never run on other CPUs. The "cpu-map" directive specifies CPU sets for individual @@ -1349,12 +1349,12 @@ cpu-map [auto:][/] ... using "all", only odd numbers using "odd" or even numbers using "even", just like with the "thread" bind directive. The second and forthcoming arguments are CPU sets. Each CPU set is either a unique number starting at 0 for the - first CPU or a range with two such numbers delimited by a dash ('-'). Outside - of Linux and BSDs, there may be a limitation on the maximum CPU index to - either 31 or 63. Multiple CPU numbers or ranges may be specified, and the - processes or threads will be allowed to bind to all of them. Obviously, - multiple "cpu-map" directives may be specified. Each "cpu-map" directive will - replace the previous ones when they overlap. + first CPU or a range with two such numbers delimited by a dash ('-'). These + CPU numbers and ranges may be repeated by delimiting them with commas or by + passing more ranges as new arguments on the same line. Outside of Linux and + BSD operating systems, there may be a limitation on the maximum CPU index to + either 31 or 63. Multiple "cpu-map" directives may be specified, but each + "cpu-map" directive will replace the previous ones when they overlap. Ranges can be partially defined. The higher bound can be omitted. In such case, it is replaced by the corresponding maximum value, 32 or 64 depending @@ -1387,6 +1387,7 @@ cpu-map [auto:][/] ... cpu-map auto:1/1-4 0-3 cpu-map auto:1/1-4 0-1 2-3 cpu-map auto:1/1-4 3 2 1 0 + cpu-map auto:1/1-4 3,2,1,0 # bind each thread to exactly one CPU using all/odd/even keyword cpu-map auto:1/all 0-63 @@ -1406,10 +1407,10 @@ cpu-map [auto:][/] ... # Map 80 threads to one physical socket and 80 others to another socket # without forcing assignment. These are split into 4 groups since no # group may have more than 64 threads. - cpu-map 1/1-40 0-39 80-119 # node0, siblings 0 & 1 - cpu-map 2/1-40 0-39 80-119 - cpu-map 3/1-40 40-79 120-159 # node1, siblings 0 & 1 - cpu-map 4/1-40 40-79 120-159 + cpu-map 1/1-40 0-39,80-119 # node0, siblings 0 & 1 + cpu-map 2/1-40 0-39,80-119 + cpu-map 3/1-40 40-79,120-159 # node1, siblings 0 & 1 + cpu-map 4/1-40 40-79,120-159 crt-base diff --git a/include/haproxy/cfgparse.h b/include/haproxy/cfgparse.h index 29937ff9b..7bd4725f9 100644 --- a/include/haproxy/cfgparse.h +++ b/include/haproxy/cfgparse.h @@ -124,7 +124,7 @@ int too_many_args(int maxarg, char **args, char **msg, int *err_code); int alertif_too_many_args_idx(int maxarg, int index, const char *file, int linenum, char **args, int *err_code); int alertif_too_many_args(int maxarg, const char *file, int linenum, char **args, int *err_code); int parse_process_number(const char *arg, unsigned long *proc, int max, int *autoinc, char **err); -unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, int comma_allowed, char **err); +unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, char **err); void free_email_alert(struct proxy *p); const char *cfg_find_best_match(const char *word, const struct list *list, int section, const char **extra); int warnifnotcap(struct proxy *proxy, int cap, const char *file, int line, const char *arg, const char *hint); diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index 76d176904..cc643f46e 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -1102,7 +1102,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) *slash = '/'; } - if (parse_cpu_set((const char **)args+2, &cpus, 0, &errmsg)) { + if (parse_cpu_set((const char **)args+2, &cpus, &errmsg)) { ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg); err_code |= ERR_ALERT | ERR_FATAL; goto out; diff --git a/src/cfgparse.c b/src/cfgparse.c index 8e6295db1..328836af5 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -516,13 +516,12 @@ int parse_process_number(const char *arg, unsigned long *proc, int max, int *aut #ifdef USE_CPU_AFFINITY /* Parse cpu sets. Each CPU set is either a unique number between 0 and * ha_cpuset_size() - 1 or a range with two such numbers delimited by a dash - * ('-'). If is set, each CPU set can be a list of unique - * numbers or ranges separated by a comma. It is also possible to specify - * multiple cpu numbers or ranges in distinct argument in . On success, - * it returns 0, otherwise it returns 1 with an error message in . + * ('-'). Each CPU set can be a list of unique numbers or ranges separated by + * a comma. It is also possible to specify multiple cpu numbers or ranges in + * distinct argument in . On success, it returns 0, otherwise it returns + * 1 with an error message in . */ -unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, - int comma_allowed, char **err) +unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, char **err) { int cur_arg = 0; const char *arg; @@ -541,7 +540,7 @@ unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, low = high = str2uic(arg); - comma = comma_allowed ? strchr(arg, ',') : NULL; + comma = strchr(arg, ','); dash = strchr(arg, '-'); if (dash && (!comma || dash < comma)) @@ -2637,7 +2636,7 @@ static int numa_detect_topology() parse_cpu_set_args[0] = trash.area; parse_cpu_set_args[1] = "\0"; - if (parse_cpu_set(parse_cpu_set_args, &active_cpus, 1, &err)) { + if (parse_cpu_set(parse_cpu_set_args, &active_cpus, &err)) { ha_notice("Cannot read online CPUs list: '%s'. Will not try to refine binding\n", err); free(err); goto free_scandir_entries;