diff -up irqbalance-1.0.7/cputree.c.orig irqbalance-1.0.7/cputree.c --- irqbalance-1.0.7/cputree.c.orig 2016-01-09 20:15:41.928969895 +0100 +++ irqbalance-1.0.7/cputree.c 2016-01-09 20:16:23.502347264 +0100 @@ -59,8 +59,8 @@ cpumask_t cpu_possible_map; 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 + * By default do not place IRQs on CPUs the kernel keeps isolated or + * nohz_full, as specified through the boot commandline. Users can * override this with the IRQBALANCE_BANNED_CPUS environment variable. */ static void setup_banned_cpus(void) @@ -69,7 +69,13 @@ static void setup_banned_cpus(void) char *c, *line = NULL; size_t size = 0; const char *isolcpus = "isolcpus="; + const char *nohz_full_s = "nohz_full="; char buffer[4096]; + cpumask_t nohz_full; + cpumask_t isolated_cpus; + + cpus_clear(isolated_cpus); + cpus_clear(nohz_full); /* A manually specified cpumask overrides auto-detection. */ if (getenv("IRQBALANCE_BANNED_CPUS")) { @@ -77,6 +83,33 @@ static void setup_banned_cpus(void) goto out; } + file = fopen("/sys/devices/system/cpu/nohz_full", "r"); + if (!file) + goto cmdline; + + if (getline(&line, &size, file) > 0) { + cpulist_parse(line, size, nohz_full); + free(line); + line = NULL; + size = 0; + } + fclose(file); + + file = fopen("/sys/devices/system/cpu/isolated", "r"); + if (file) { + if (getline(&line, &size, file) > 0) { + cpulist_parse(line, size, isolated_cpus); + free(line); + line = NULL; + size = 0; + } + fclose(file); + } + + goto out2; + + cmdline: + file = fopen("/proc/cmdline", "r"); if (!file) goto out; @@ -92,12 +125,31 @@ static void setup_banned_cpus(void) for (end = c; *end != ' ' && *end != '\0' && *end != '\n'; end++); len = end - c; - cpulist_parse(c, len, banned_cpus); + cpulist_parse(c, len, isolated_cpus); } + if ((c = strstr(line, nohz_full_s))) { + char *end; + int len; + + c += strlen(nohz_full_s); + for (end = c; *end != ' ' && *end != '\0' && *end != '\n'; end++); + len = end - c; + + cpulist_parse(c, len, nohz_full); + } + + free(line); + fclose(file); + + out2: + cpus_or(banned_cpus, nohz_full, isolated_cpus); + out: - cpumask_scnprintf(buffer, 4096, banned_cpus); + cpumask_scnprintf(buffer, 4096, isolated_cpus); log(TO_CONSOLE, LOG_INFO, "Isolated CPUs: %s\n", buffer); + cpumask_scnprintf(buffer, 4096, nohz_full); + log(TO_CONSOLE, LOG_INFO, "Adaptive-ticks CPUs: %s\n", buffer); } static struct topo_obj* add_cache_domain_to_package(struct topo_obj *cache,