diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-10-16 18:16:17 -0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-10-16 18:16:17 -0200 |
commit | 7b8f749c7b54076c9f88b85b18364ce905dfc62e (patch) | |
tree | 7c919e47c2798796c74a12f78c3a34cb1eee9662 | |
parent | 9eaa9bafa0d6d22083077b1c383762fd1abe6969 (diff) | |
download | tuna-7b8f749c7b54076c9f88b85b18364ce905dfc62e.tar.gz |
tuna: Set the irq affinity mask when setting the IRQ thread affinity
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | tuna/tuna.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tuna/tuna.py b/tuna/tuna.py index c2be7bd..5468012 100755 --- a/tuna/tuna.py +++ b/tuna/tuna.py @@ -142,6 +142,12 @@ def list_to_cpustring(l): prev = i return ",".join(strings) +# FIXME: move to python-linux-procfs +def is_hardirq_handler(self, pid): + PF_HARDIRQ = 0x08000000 + return int(self.processes[pid]["stat"]["flags"]) & \ + PF_HARDIRQ and True or False + def move_threads_to_cpu(cpus, pid_list, set_affinity_warning = None, spread = False): changed = False @@ -150,6 +156,7 @@ def move_threads_to_cpu(cpus, pid_list, set_affinity_warning = None, cpu_idx = 0 nr_cpus = len(cpus) new_affinity = cpus + last_cpu = max(cpus) + 1 for pid in pid_list: if spread: new_affinity = [cpus[cpu_idx]] @@ -170,6 +177,13 @@ def move_threads_to_cpu(cpus, pid_list, set_affinity_warning = None, continue if set(curr_affinity) == set(new_affinity): changed = True + if is_hardirq_handler(ps, pid): + try: + irq = int(ps[pid]["stat"]["comm"][4:]) + bitmasklist = procfs.hexbitmask(new_affinity, last_cpu) + set_irq_affinity(irq, bitmasklist) + except: + pass elif set_affinity_warning: set_affinity_warning(pid, new_affinity) else: |