diff --git a/tuned/plugins/plugin_cpu.py b/tuned/plugins/plugin_cpu.py index 50ccef43..eec9fd70 100644 --- a/tuned/plugins/plugin_cpu.py +++ b/tuned/plugins/plugin_cpu.py @@ -798,7 +798,13 @@ def _set_energy_performance_preference(self, energy_performance_preference, devi if not sim: avail_vals = set(self._cmd.read_file(self._pstate_preference_path(cpu_id, True)).split()) for val in vals: - if val in avail_vals: + try: + val = int(val) + valid = 0 <= val < 256 + val = str(val) + except ValueError: + valid = val in avail_vals + if valid: self._cmd.write_to_file(self._pstate_preference_path(cpu_id), val, \ no_error = [errno.ENOENT] if remove else False, ignore_same=True) log.info("Setting energy_performance_preference value '%s' for cpu '%s'" % (val, device))