|
|
c890d2 |
diff --git a/tuned/plugins/plugin_scheduler.py b/tuned/plugins/plugin_scheduler.py
|
|
|
c890d2 |
index 25c38dd..07fac52 100644
|
|
|
c890d2 |
--- a/tuned/plugins/plugin_scheduler.py
|
|
|
c890d2 |
+++ b/tuned/plugins/plugin_scheduler.py
|
|
|
c890d2 |
@@ -379,8 +379,12 @@ class SchedulerPlugin(base.Plugin):
|
|
|
c890d2 |
|
|
|
c890d2 |
def _set_all_obj_affinity(self, objs, affinity, threads = False, intersect = False):
|
|
|
c890d2 |
_affinity = affinity
|
|
|
c890d2 |
- for obj in objs:
|
|
|
c890d2 |
- if self._affinity_changeable(obj, process = objs[obj]) != 1:
|
|
|
c890d2 |
+ psl = [v for v in objs if re.search(self._ps_whitelist, self._get_stat_comm(v)) is not None]
|
|
|
c890d2 |
+ if self._ps_blacklist != "":
|
|
|
c890d2 |
+ psl = [v for v in psl if re.search(self._ps_blacklist, self._get_stat_comm(v)) is None]
|
|
|
c890d2 |
+ psd = dict([(v.pid, v) for v in psl])
|
|
|
c890d2 |
+ for obj in psd:
|
|
|
c890d2 |
+ if self._affinity_changeable(obj, process = psd[obj]) != 1:
|
|
|
c890d2 |
continue
|
|
|
c890d2 |
prev_affinity = self._get_affinity2(obj)
|
|
|
c890d2 |
if prev_affinity is None:
|
|
|
c890d2 |
@@ -391,8 +395,8 @@ class SchedulerPlugin(base.Plugin):
|
|
|
c890d2 |
if not self._set_affinity2(obj, _affinity):
|
|
|
c890d2 |
continue
|
|
|
c890d2 |
# process threads
|
|
|
c890d2 |
- if not threads and objs[obj].has_key("threads"):
|
|
|
c890d2 |
- self._set_all_obj_affinity(dict(objs[obj]["threads"].items()), affinity, True, intersect)
|
|
|
c890d2 |
+ if not threads and "threads" in psd[obj]:
|
|
|
c890d2 |
+ self._set_all_obj_affinity(psd[obj]["threads"].values(), affinity, True, intersect)
|
|
|
c890d2 |
|
|
|
c890d2 |
def _get_stat_comm(self, o):
|
|
|
c890d2 |
try:
|
|
|
c890d2 |
@@ -405,11 +409,7 @@ class SchedulerPlugin(base.Plugin):
|
|
|
c890d2 |
affinity_hex = self._cmd.cpulist2hex(_affinity)
|
|
|
c890d2 |
ps = procfs.pidstats()
|
|
|
c890d2 |
ps.reload_threads()
|
|
|
c890d2 |
- psl = filter(lambda v: re.search(self._ps_whitelist, self._get_stat_comm(v)) is not None, ps.values())
|
|
|
c890d2 |
- if self._ps_blacklist != "":
|
|
|
c890d2 |
- psl = filter(lambda v: re.search(self._ps_blacklist, self._get_stat_comm(v)) is None, psl)
|
|
|
c890d2 |
- psd = dict(map(lambda v: (v.pid, v), psl))
|
|
|
c890d2 |
- self._set_all_obj_affinity(psd, affinity, False, intersect)
|
|
|
c890d2 |
+ self._set_all_obj_affinity(ps.values(), affinity, False, intersect)
|
|
|
c890d2 |
|
|
|
c890d2 |
# process IRQs
|
|
|
c890d2 |
irqs = procfs.interrupts()
|