[PATCH 13/23] tuna: Fix run command failing to apply BATCH policy

John Kacur
2025-11-07T18:58:13Z

When using tuna run with -p BATCH the newly spawned process is created
with SCHED_OTHER instead of SCHED_BATCH

Fix this by calling thread_set_priority if the policy is not zero

Signed-off-by: John Kacur <jkacur@redhat.com>
---
tuna/tuna.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tuna/tuna.py b/tuna/tuna.py
index d4c3e2c1a661..1380df0dadba 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -621,7 +621,7 @@ def run_command(cmd, policy, rtprio, cpu_list, background):
if newpid == 0:
cmd_list = shlex.split(cmd)
pid = os.getpid()
- if rtprio:
+ if rtprio or policy:
try:
thread_set_priority(pid, policy, rtprio)
except (SystemError, OSError) as err:
--
2.51.1