User can set some adaptive-ticks CPUs through kernel parameter nohz_full= so these CPUs won't receive any scheduling clock when there will be less than 2 running tasks. Thus assigning IRQs to these CPUs would harm performance of tasks pinned there. Signed-off-by: Petr Holasek <pholasek at redhat.com> --- cputree.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/cputree.c b/cputree.c index dce85f9..54b3d05 100644 --- a/cputree.c +++ b/cputree.c @@ -60,10 +60,14 @@ cpumask_t unbanned_cpus; /* * By default do not place IRQs on CPUs the kernel keeps isolated, - * as specified through the isolcpus= boot commandline. Users can - * override this with the IRQBALANCE_BANNED_CPUS environment variable. - */ -static int find_cmdline_cpumask(const char *param, char *line, cpumask_t out) + * as specified through the isolcpus= boot commandline. Also do not + * place IRQs on adaptive-ticks CPUs not receiving scheduling-clock + * while running only one task specified through the nohz_full= boot + * commandline argument. + * Users can override this with the IRQBALANCE_BANNED_CPUS environment + * variable. +*/ +static void find_cmdline_cpumask(const char *param, char *line, cpumask_t *out) { char *c; @@ -75,12 +79,8 @@ static int find_cmdline_cpumask(const char *param, char *line, cpumask_t out) for (end = c; *end != ' ' && *end != '\0' && *end != '\n'; end++); len = end - c; - cpulist_parse(c, len, out); - - return 0; + cpulist_parse(c, len, *out); } - - return 1; } static void setup_banned_cpus(void) @@ -89,6 +89,8 @@ static void setup_banned_cpus(void) char *line = NULL; size_t size = 0; const char *isolcpus = "isolcpus="; + const char *nohz_full = "nohz_full="; + cpumask_t isolcpus_mask, nohz_full_mask; char buffer[4096]; /* A manually specified cpumask overrides auto-detection. */ @@ -104,14 +106,18 @@ static void setup_banned_cpus(void) if (getline(&line, &size, file) <= 0) goto out2; - find_cmdline_cpumask(isolcpus, line, banned_cpus); + find_cmdline_cpumask(isolcpus, line, &isolcpus_mask); + find_cmdline_cpumask(nohz_full, line, &nohz_full_mask); + cpus_or(banned_cpus, isolcpus_mask, nohz_full_mask); + free(line); out2: fclose(file); out: - cpumask_scnprintf(buffer, 4096, banned_cpus); + cpumask_scnprintf(buffer, 4096, isolcpus_mask); log(TO_CONSOLE, LOG_INFO, "Isolated CPUs: %s\n", buffer); - free(line); + cpumask_scnprintf(buffer, 4096, nohz_full_mask); + log(TO_CONSOLE, LOG_INFO, "Adaptive-tisks CPUs: %s\n", buffer); } static struct topo_obj* add_cache_domain_to_package(struct topo_obj *cache, -- 2.4.3