From 673d253ac138f67c76c0d3127a7ebb2013d8ebda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Sun, 20 May 2018 12:30:38 +0200 Subject: [PATCH] scheduler: Drop no_error argument in _get_affinity() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I believe it was originally added so that errors are not logged when we fail to read the affinity of a short-lived process which has already disappeared. This is no longer necessary, because we always check if the process has disappeared, and log debug messages instead of errors if it has. Signed-off-by: Ondřej Lysoněk --- tuned/plugins/plugin_scheduler.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tuned/plugins/plugin_scheduler.py b/tuned/plugins/plugin_scheduler.py index ee9f8b0..f3e26b0 100644 --- a/tuned/plugins/plugin_scheduler.py +++ b/tuned/plugins/plugin_scheduler.py @@ -142,14 +142,13 @@ class SchedulerPlugin(base.Plugin): log.debug("read scheduler policy '%s' and priority '%s' for pid '%s'" % (sched, prio, pid)) return (sched, prio) - def _get_affinity(self, pid, no_error = False): - (rc, out, err_msg) = self._cmd.execute(["taskset", "-p", str(pid)], no_errors = [1] if no_error else [], return_err = True) + def _get_affinity(self, pid): + (rc, out, err_msg) = self._cmd.execute(["taskset", "-p", str(pid)], no_errors = [], return_err = True) if rc != 0: - if rc != 1 or not no_error: - if self._pid_exists(pid): - log.error(err_msg) - else: - log.debug("Unable to read affinity for PID %s, the task vanished." % pid) + if rc != 1 or self._pid_exists(pid): + log.error(err_msg) + else: + log.debug("Unable to read affinity for PID %s, the task vanished." % pid) return None v = self._parse_val(out.split("\n", 1)[0]) log.debug("read affinity '%s' for pid '%s'" % (v, pid)) @@ -230,7 +229,7 @@ class SchedulerPlugin(base.Plugin): def _tune_process(self, pid, cmd, sched, prio, affinity, no_error = False): #rt[0] - prev_sched, rt[1] - prev_prio rt = self._get_rt(pid) - prev_affinity = self._get_affinity(pid, no_error) + prev_affinity = self._get_affinity(pid) if prev_affinity is not None and rt is not None and len(rt) == 2 and rt[0] is not None and rt[1] is not None: self._scheduler_original[pid] = (cmd, rt[0], rt[1], prev_affinity) self._set_rt(pid, self._schedcfg2param(sched), prio, no_error)