Example #1
0
def collect_cpu_config(metadata, cpus):
    nohz_full = read_first_line(sysfs_path('devices/system/cpu/nohz_full'))
    if nohz_full:
        nohz_full = parse_cpu_list(nohz_full)

    isolated = get_isolated_cpus()
    if isolated:
        isolated = set(isolated)

    configs = {}
    for cpu in cpus:
        config = get_cpu_config(cpu)
        if nohz_full and cpu in nohz_full:
            config.append('nohz_full')
        if isolated and cpu in isolated:
            config.append('isolated')
        if config:
            configs[cpu] = ', '.join(config)
    config = format_cpu_infos(configs)

    cpuidle = read_first_line('/sys/devices/system/cpu/cpuidle/current_driver')
    if cpuidle:
        config.append('idle:%s' % cpuidle)

    if not config:
        return
    metadata['cpu_config'] = '; '.join(config)
Example #2
0
    def _cpu_affinity(self):
        cpus = self.args.affinity
        if not cpus:
            # --affinity option is not set: detect isolated CPUs
            isolated = True
            cpus = get_isolated_cpus()
            if not cpus:
                # no isolated CPUs or unable to get the isolated CPUs
                return
        else:
            isolated = False
            cpus = parse_cpu_list(cpus)

        if set_cpu_affinity(cpus):
            if self.args.verbose:
                if isolated:
                    text = ("Pin process to isolated CPUs: %s"
                            % format_cpu_list(cpus))
                else:
                    text = ("Pin process to CPUs: %s"
                            % format_cpu_list(cpus))
                print(text)

            if isolated:
                self.args.affinity = format_cpu_list(cpus)
        else:
            if not isolated:
                print("ERROR: CPU affinity not available.", file=sys.stderr)
                print("Use Python 3.3 or newer, or install psutil dependency")
                sys.exit(1)
            elif not self.args.quiet:
                print("WARNING: unable to pin worker processes to "
                      "isolated CPUs, CPU affinity not available")
                print("Use Python 3.3 or newer, or install psutil dependency")
Example #3
0
def collect_cpu_config(metadata, cpus):
    nohz_full = read_first_line(sysfs_path('devices/system/cpu/nohz_full'))
    if nohz_full:
        nohz_full = parse_cpu_list(nohz_full)

    isolated = get_isolated_cpus()
    if isolated:
        isolated = set(isolated)

    configs = {}
    for cpu in cpus:
        config = get_cpu_config(cpu)
        if nohz_full and cpu in nohz_full:
            config.append('nohz_full')
        if isolated and cpu in isolated:
            config.append('isolated')
        if config:
            configs[cpu] = ', '.join(config)
    config = format_cpu_infos(configs)

    cpuidle = read_first_line('/sys/devices/system/cpu/cpuidle/current_driver')
    if cpuidle:
        config.append('idle:%s' % cpuidle)

    if not config:
        return
    metadata['cpu_config'] = '; '.join(config)
Example #4
0
 def parse_affinity(value):
     try:
         cpus = parse_cpu_list(value)
     except ValueError:
         cpus = None
     if not cpus:
         raise argparse.ArgumentTypeError('invalid CPU list: %r' % value)
     return cpus
Example #5
0
    def read_rcu_nocbs(self):
        cmdline = self.read_first_line(proc_path('cmdline'))
        if not cmdline:
            return

        match = re.search(r'\brcu_nocbs=([^ ]+)', cmdline)
        if not match:
            return

        cpus = match.group(1)
        return parse_cpu_list(cpus)
Example #6
0
    def read_rcu_nocbs(self):
        cmdline = self.read_first_line(proc_path('cmdline'))
        if not cmdline:
            return

        match = re.search(r'\brcu_nocbs=([^ ]+)', cmdline)
        if not match:
            return

        cpus = match.group(1)
        return parse_cpu_list(cpus)
Example #7
0
    def show(self):
        nohz_full = self.read_first_line(sysfs_path('devices/system/cpu/nohz_full'))
        if not nohz_full:
            return

        nohz_full = parse_cpu_list(nohz_full)
        if not nohz_full:
            return

        used = set(self.system.cpus) | set(nohz_full)
        if not used:
            return

        self.advice("WARNING: nohz_full is enabled on CPUs %s which use the "
                    "intel_pstate driver, whereas intel_pstate is incompatible "
                    "with nohz_full"
                    % format_cpu_list(used))
        self.advice("See https://bugzilla.redhat.com/show_bug.cgi?id=1378529")
        self.tuned_for_benchmarks = False
Example #8
0
    def show(self):
        nohz_full = self.read_first_line(sysfs_path('devices/system/cpu/nohz_full'))
        if not nohz_full:
            return

        nohz_full = parse_cpu_list(nohz_full)
        if not nohz_full:
            return

        used = set(self.system.cpus) | set(nohz_full)
        if not used:
            return

        self.advice("WARNING: nohz_full is enabled on CPUs %s which use the "
                    "intel_pstate driver, whereas intel_pstate is incompatible "
                    "with nohz_full"
                    % format_cpu_list(used))
        self.advice("See https://bugzilla.redhat.com/show_bug.cgi?id=1378529")
        self.tuned_for_benchmarks = False