[PATCH] rteval: stressng: Apply taskset to exclude isolated CPUs

John Kacur <[email protected]>
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
The stress-ng load module was only applying --taskset when the user
explicitly provided a cpulist via --loads-cpulist. When no cpulist
was provided, stress-ng would run without CPU affinity restrictions,
potentially interfering with isolated CPUs reserved for measurement
modules.

The code already calculated the non-isolated CPUs (lines 72-74) but
failed to use them for taskset. This inconsistency differs from other
load modules (kcompile, hackbench) which always restrict loads to
non-isolated CPUs.

Fix by always applying --taskset based on the calculated available
CPUs, combining all NUMA nodes into a single CPU list. This ensures
isolated CPUs remain reserved for measurement modules regardless of
whether the user provides an explicit cpulist.

Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: John Kacur <[email protected]>
---
 rteval/modules/loads/stressng.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/rteval/modules/loads/stressng.py b/rteval/modules/loads/stressng.py
index 387b5718a08f..03fe8429e7b5 100644
--- a/rteval/modules/loads/stressng.py
+++ b/rteval/modules/loads/stressng.py
@@ -79,10 +79,16 @@ class Stressng(CommandLineLoad):
             if not cpu:
                 nodes.remove(node)
                 self._log(Log.DEBUG, f"node {node} has no available cpus, removing")
-        if self.cpulist:
-            for node in nodes:
-                cpulist = ",".join([str(n) for n in cpus[node]])
-                self.args.extend(['--taskset', cpulist])
+
+        # Always apply taskset to restrict stress-ng to available CPUs
+        # This ensures isolated CPUs are excluded (reserved for measurement modules)
+        all_cpus = []
+        for node in nodes:
+            all_cpus.extend(cpus[node])
+
+        if all_cpus:
+            cpulist = ",".join([str(c) for c in all_cpus])
+            self.args.extend(['--taskset', cpulist])
 
     def _WorkloadTask(self):
         """ Kick of the workload here """
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.