import tuna-0.16-5.el8

This commit is contained in:
CentOS Sources 2021-12-16 10:24:58 +00:00 committed by Stepan Oksanichenko
parent 609388a78e
commit ca3f0941aa
2 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,61 @@
From 6e43ce523e7b403cc4f5e94c988d8811d2053e0f Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Tue, 14 Dec 2021 14:59:50 -0500
Subject: [PATCH] tuna: Fix tuna displays incorrect cpu affinity when cpu is
offlined
If we create a process and query it's affinity, both taskset and tuna
display the same result, but if we then disable a processor, tuna
displays the wrong affinity, as below.
[jkacur@fionn tuna]$ sha1sum /dev/zero &
[1] 10640
[jkacur@fionn tuna]$ taskset -p 10640
pid 10640's current affinity mask: fff
[jkacur@fionn tuna]$ su -c './tuna-cmd.py -t sha1sum -P'
Password:
thread ctxt_switches
pid SCHED_ rtpri affinity voluntary nonvoluntary cmd
10640 OTHER 0 0xfff 0 423 sha1sum
[jkacur@fionn tuna]$ su -c 'chcpu -d 5'
Password:
CPU 5 disabled
[jkacur@fionn tuna]$ taskset -p 10640
pid 10640's current affinity mask: fdf
[jkacur@fionn tuna]$ su -c './tuna-cmd.py -t sha1sum -P'
Password:
thread ctxt_switches
pid SCHED_ rtpri affinity voluntary nonvoluntary cmd
10640 OTHER 0 0x7df 0 919 sha1sum
The reason for this is that after tuna gets the affinity for the
process, when it converts this to a hex value, it passes the number of
enabled processors to hexbitmask in procfs, when what we really need is
the number of processors including disabled ones.
Fix this by querrying SC_NPROCESSORS_CONF and passing that value to
hexbitmask.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
tuna-cmd.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tuna-cmd.py b/tuna-cmd.py
index d209a2e89493..7e33a128d676 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -199,7 +199,9 @@ def format_affinity(affinity):
if len(affinity) <= 4:
return ",".join(str(a) for a in affinity)
- return ",".join(str(hex(a)) for a in procfs.hexbitmask(affinity, get_nr_cpus()))
+ # We need the number of cpus on a system, including disabled ones
+ ncpus = os.sysconf('SC_NPROCESSORS_CONF')
+ return ",".join(str(hex(a)) for a in procfs.hexbitmask(affinity, ncpus))
def ps_show_thread(pid, affect_children, ps, has_ctxt_switch_info, sock_inodes,
--
2.31.1

View File

@ -1,6 +1,6 @@
Name: tuna
Version: 0.16
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2
Summary: Application tuning GUI & command line utility
Group: Applications/System
@ -19,6 +19,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Patch1: tuna-Add-distinction-between-spread-and-move-to-erro.patch
Patch2: tuna-Print-warning-if-setting-affinity-results-in-EBUSY.patch
Patch3: tuna-Make-it-clear-that-include-and-isolate-affects-IRQs.patch
Patch4: tuna-Fix-tuna-displays-incorrect-cpu-affinity-when-c.patch
%description
Provides interface for changing scheduler and IRQ tunables, at whole CPU and at
@ -34,6 +35,7 @@ installed.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
%{__python3} setup.py build
@ -80,6 +82,10 @@ rm -rf %{buildroot}
%{_datadir}/polkit-1/actions/org.tuna.policy
%changelog
* Tue Dec 14 2021 John Kacur <jkacur@redhat.com> - 0.16-5
- Display correct cpu-affinity when a cpu is disabled
Resolves: rhbz#2032614
* Wed Nov 10 2021 John Kacur <jkacur@redhat.com> - 0.16-4
- Make it clear in online help and man pages that --include and --isolate
affect IRQs as well as threads