Skip to contentSkip to conversation

rteval: stressng: Apply taskset to exclude isolated CPUs

PATCH New John Kacur 1 participant 1 message Aug 10

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/1 rteval: stressng: Apply taskset to exclude isolated CPUs

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
---
 rteval/modules/loads/stressng.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
rteval/modules/loads/stressng.py +10 -4
index 387b5718a08f..03fe8429e7b5 100644
@@ -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 """
Signature · 1 line
2.55.0