summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2018-08-08 13:41:25 +0200
committerJohn Kacur <jkacur@redhat.com>2018-08-08 13:41:25 +0200
commit73a941a0fbf93505a3ceefdd6c6cd9ddb3e1b7b0 (patch)
treeb99ff3fffc152bc1b08f81620d3af621cafacf76
parente796eff3edca1378f10c2f9f28fb8e9a1b1db305 (diff)
downloadtuna-73a941a0fbf93505a3ceefdd6c6cd9ddb3e1b7b0.tar.gz
tuna: Remove some functions to python-linux-procfs
Removes some generic affinity functions and get them from python-linux-procfs Signed-off-by: John Kacur <jkacur@redhat.com>
-rwxr-xr-xtuna/tuna.py26
1 files changed, 4 insertions, 22 deletions
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 0ef0bf9..9f92678 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -173,24 +173,6 @@ def is_hardirq_handler(self, pid):
except:
return False
-# FIXME: move to python-linux-procfs
-def cannot_set_affinity(self, pid):
- PF_NO_SETAFFINITY = 0x04000000
- try:
- return int(self.processes[pid]["stat"]["flags"]) & \
- PF_NO_SETAFFINITY and True or False
- except:
- return True
-
-# FIXME: move to python-linux-procfs
-def cannot_set_thread_affinity(self, pid, tid):
- PF_NO_SETAFFINITY = 0x04000000
- try:
- return int(self.processes[pid].threads[tid]["stat"]["flags"]) & \
- PF_NO_SETAFFINITY and True or False
- except:
- return True
-
def move_threads_to_cpu(cpus, pid_list, set_affinity_warning = None,
spread = False):
changed = False
@@ -349,7 +331,7 @@ def isolate_cpus(cpus, nr_cpus):
ps.reload_threads()
previous_pid_affinities = {}
for pid in list(ps.keys()):
- if cannot_set_affinity(ps, pid):
+ if procfs.cannot_set_affinity(ps, pid):
continue
try:
affinity = schedutils.get_affinity(pid)
@@ -377,7 +359,7 @@ def isolate_cpus(cpus, nr_cpus):
continue
threads = ps[pid]["threads"]
for tid in list(threads.keys()):
- if cannot_set_thread_affinity(ps, pid, tid):
+ if procfs.cannot_set_thread_affinity(ps, pid, tid):
continue
try:
affinity = schedutils.get_affinity(tid)
@@ -429,7 +411,7 @@ def include_cpus(cpus, nr_cpus):
ps.reload_threads()
previous_pid_affinities = {}
for pid in list(ps.keys()):
- if cannot_set_affinity(ps, pid):
+ if procfs.cannot_set_affinity(ps, pid):
continue
try:
affinity = schedutils.get_affinity(pid)
@@ -451,7 +433,7 @@ def include_cpus(cpus, nr_cpus):
continue
threads = ps[pid]["threads"]
for tid in list(threads.keys()):
- if cannot_set_thread_affinity(ps, pid, tid):
+ if procfs.cannot_set_thread_affinity(ps, pid, tid):
continue
try:
affinity = schedutils.get_affinity(tid)