import tuna-0.16-6.el9

This commit is contained in:
CentOS Sources 2022-01-11 13:32:29 -05:00 committed by Stepan Oksanichenko
parent 8d2126fcc1
commit 3bb4e5c8e0
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: 5%{?dist}
Release: 6%{?dist}
License: GPLv2
Summary: Application tuning GUI & command line utility
URL: https://git.kernel.org/pub/scm/utils/tuna/tuna.git
@ -17,6 +17,7 @@ Requires: python3-linux-procfs >= 0.6
Patch1: tuna-Print-warning-if-setting-affinity-results-in-EBUSY.patch
Patch2: tuna-Add-distinction-between-spread-and-move-to-erro.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
@ -32,6 +33,7 @@ installed.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
%py3_build
@ -73,6 +75,10 @@ done
%{_datadir}/polkit-1/actions/org.tuna.policy
%changelog
* Tue Dec 14 2021 John Kacur <jkacur@redhat.com> - 0.16-6
- Display correct cpu-affinity when a cpu is disabled
Resolves: rhbz#2032460
* Thu Nov 11 2021 John Kacur <jkacur@redhat.com> - 0.16-5
- Make it clear in online help and man pages that --include and --isolate
affect IRQs as well as threads