When a realtime scheduling policy is used, default the prio to 1
Resolves: RHEL-106072 Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
parent
7778efb16c
commit
5714ff3aaf
66
tuna-Fix-setting-a-realtime-scheduling-policy.patch
Normal file
66
tuna-Fix-setting-a-realtime-scheduling-policy.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From 7f0b375a323be5e2830e4afbecd7ffbd0f4e9824 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Tue, 7 Oct 2025 12:51:14 -0400
|
||||
Subject: [PATCH] tuna: Fix setting a realtime scheduling policy
|
||||
|
||||
According to the tuna documentation if a user specifies a real-time
|
||||
scheduling policy then the default priority is 1 if not specified.
|
||||
|
||||
Fix this in the gui by explicitly setting it to one in
|
||||
thread_set_attributes
|
||||
|
||||
There were also some incorrect debugging messages in
|
||||
thread_set_attributes because the affinity was sometimes treated as a
|
||||
list and sometimes treated as a set.
|
||||
|
||||
Fix this by converting the results of os.sched_getscheduler(pid) to a
|
||||
list
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
tuna/gui/util.py | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tuna/gui/util.py b/tuna/gui/util.py
|
||||
index 92bd368179cc..68bd7578f1c8 100644
|
||||
--- a/tuna/gui/util.py
|
||||
+++ b/tuna/gui/util.py
|
||||
@@ -68,6 +68,9 @@ def thread_set_attributes(pid_info, new_policy, new_prio, new_affinity, nr_cpus)
|
||||
curr_prio = int(pid_info["stat"]["rt_priority"])
|
||||
if new_policy == os.SCHED_OTHER:
|
||||
new_prio = 0
|
||||
+ if new_policy == os.SCHED_FIFO or new_policy == os.SCHED_RR:
|
||||
+ if not new_prio:
|
||||
+ new_prio = 1
|
||||
if curr_policy != new_policy or curr_prio != new_prio:
|
||||
param = os.sched_param(new_prio)
|
||||
try:
|
||||
@@ -82,6 +85,7 @@ def thread_set_attributes(pid_info, new_policy, new_prio, new_affinity, nr_cpus)
|
||||
dialog.destroy()
|
||||
return False
|
||||
|
||||
+
|
||||
curr_policy = os.sched_getscheduler(pid)
|
||||
if curr_policy != new_policy:
|
||||
print(_("couldn't change pid %(pid)d from %(cpol)s(%(cpri)d) to %(npol)s(%(npri)d)!") % \
|
||||
@@ -93,7 +97,7 @@ def thread_set_attributes(pid_info, new_policy, new_prio, new_affinity, nr_cpus)
|
||||
changed = True
|
||||
|
||||
try:
|
||||
- curr_affinity = os.sched_getaffinity(pid)
|
||||
+ curr_affinity = list(os.sched_getaffinity(pid))
|
||||
except OSError as err:
|
||||
if err.args[0] == errno.ESRCH:
|
||||
return False
|
||||
@@ -116,7 +120,7 @@ def thread_set_attributes(pid_info, new_policy, new_prio, new_affinity, nr_cpus)
|
||||
return invalid_affinity()
|
||||
|
||||
try:
|
||||
- curr_affinity = os.sched_getaffinity(pid)
|
||||
+ curr_affinity = list(os.sched_getaffinity(pid))
|
||||
except OSError as err:
|
||||
if err.args[0] == errno.ESRCH:
|
||||
return False
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: tuna
|
||||
Version: 0.19
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
License: GPL-2.0-only AND LGPL-2.1-only
|
||||
Summary: Application tuning GUI & command line utility
|
||||
URL: https://git.kernel.org/pub/scm/utils/tuna/tuna.git
|
||||
@ -30,6 +30,7 @@ Patch14: tuna-Add-U-and-K-to-the-spread-command.patch
|
||||
Patch15: tuna-Proofreading-fixes.patch
|
||||
Patch16: tuna-Remove-broken-testuna.patch
|
||||
Patch17: tuna-disable-cpu_power-functionality-for-RHEL9-curre.patch
|
||||
Patch18: tuna-Fix-setting-a-realtime-scheduling-policy.patch
|
||||
|
||||
%description
|
||||
Provides interface for changing scheduler and IRQ tunables, at whole CPU and at
|
||||
@ -83,6 +84,10 @@ done
|
||||
%{_datadir}/polkit-1/actions/org.tuna.policy
|
||||
|
||||
%changelog
|
||||
* Tue Oct 07 2025 John Kacur <jkacur@redhat.com> - 0.19-11
|
||||
- When a realtime scheduling policy is used, default the prio to 1
|
||||
Resolves: RHEL-106072
|
||||
|
||||
* Wed Oct 01 2025 John Kacur <jkacur@redhat.com> - 0.19-10
|
||||
- Add -U and -K to the spread command
|
||||
- Add a few clean-ups
|
||||
|
||||
Loading…
Reference in New Issue
Block a user