Skip to contentSkip to conversation

rteval: Updated parameter names

PATCH In review Sana Sharma 2 participants 3 messages Aug 12

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rteval: Updated parameter names

Updated ModuleParameters, init and WorkloadPrepare with new parameter names.
- option is now named stressor, and
- arg is now named workers
to promote clarity.

Unit tests have also been changed to reflect this parameter renaming

---
 rteval/modules/loads/stressng.py | 25 +++++++++++++------------
 tests/e2e/loads.t                |  6 +++---
 2 files changed, 16 insertions(+), 15 deletions(-)
rteval/modules/loads/stressng.py +13 -12
index 03fe842..32e2dbd 100644
@@ -23,8 +23,8 @@ class Stressng(CommandLineLoad):
         self.__err = None
         self.__nullfp = None
         self.args = None
-        " Only run this module if the user specifies an option "
-        if self.cfg.option is not None:
+        " Only run this module if the user specifies an stressor "
+        if self.cfg.stressor is not None:
             self._donotrun = False
         else:
             self._donotrun = True
@@ -49,11 +49,11 @@ class Stressng(CommandLineLoad):
         else:
             self.__out = self.__err = self.__nullfp
 
-        # stress-ng is only run if the user specifies an option
+        # stress-ng is only run if the user specifies an stressor
         self.args = ['stress-ng']
-        self.args.append(f'--{str(self.cfg.option)}')
-        if self.cfg.arg is not None:
-            self.args.append(self.cfg.arg)
+        self.args.append(f'--{str(self.cfg.stressor)}')
+        if self.cfg.workers is not None:
+            self.args.append(self.cfg.workers) #default is 0
         if self.cfg.timeout is not None:
             self.args.append('--timeout')
             self.args.append(self.cfg.timeout)
@@ -135,13 +135,14 @@ def create(config, logger):
 def ModuleParameters():
     """ Commandline options for Stress-ng """
     return {
-        "option": {
-            "descr": "stressor specific option",
-            "metavar": "OPTION"
+        "stressor": {
+            "descr": "stressor name (eg. vm, cpu)",
+            "metavar": "STRESSOR"
         },
-        "arg": {
-            "descr": "stressor specific arg",
-            "metavar" : "ARG"
+        "workers": {
+            "descr": "number of workers(default: 0 = one per CPU)",
+            "default": "0",
+            "metavar" : "N"
         },
         "timeout": {
             "descr": "timeout after T seconds",
tests/e2e/loads.t +3 -3
index c367c46..b49002c 100644
@@ -20,15 +20,15 @@ check "stress-ng debug" \
     "--onlyload -D -d 1" 0 '\[DEBUG\]'
 
 check "stress-ng command" \
-    "--onlyload -D -d 1 --stressng-option procfs --stressng-arg 1" 0 \
+    "--onlyload -D -d 1 --stressng-stressor procfs --stressng-workers 1" 0 \
     'starting with stress-ng --procfs 1 --taskset'
 
 check "stress-ng command, with --loads-cpulist" \
-    "--onlyload -D -d 1 --loads-cpulist=0-2 --stressng-option procfs --stressng-arg 1" 0 \
+    "--onlyload -D -d 1 --loads-cpulist=0-2 --stressng-stressor procfs --stressng-workers 1" 0 \
     'starting with stress-ng --procfs 1 --taskset 0,1,2'
 
 check "stress-ng command, with --stressng-timeout" \
-    "--onlyload -D -d 1 --stressng-option procfs --stressng-arg 1 --stressng-timeout 2" 0 \
+    "--onlyload -D -d 1 --stressng-stressor procfs --stressng-workers 1 --stressng-timeout 2" 0 \
     'starting with stress-ng --procfs 1 --timeout 2'
 
 # hackbench checks
Signature · 1 line
2.54.0
#1 lore raw

Hi Sana,

Thanks for the patch! I've tested it and it works correctly:

```
rteval --onlyload -D -d 1 --stressng-stressor cpu --stressng-workers 1
[DEBUG] [stressng] starting with stress-ng --cpu 1 --taskset 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
```

The code changes look good and I'll apply this patch. However, the commit message could be more descriptive. Instead of just saying "to promote clarity", it would help reviewers to explain:

1. **What problem does this solve?** (the old names were ambiguous/generic)
2. **Why are the new names better?** (they clearly indicate purpose)
3. **What's the user-visible impact?** (command-line option changes)

For example:

```
rteval: Rename stress-ng module parameters for clarity

The stress-ng module used generic parameter names "option" and "arg"
which were ambiguous and didn't clearly indicate their purpose.

Rename for better clarity:
- "option" → "stressor": Better reflects that this specifies which
  stress-ng stressor to run (cpu, vm, etc.)
- "arg" → "workers": More accurately describes the parameter as the
  number of worker processes (default: 0 = one per CPU)

This changes the command-line options:
  --stressng-option → --stressng-stressor
  --stressng-arg → --stressng-workers

Update unit tests to reflect the new parameter names.
```

Good commit messages help future maintainers understand the reasoning behind changes.

Thanks again for the patch!

#2 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