[PATCH] rteval: Fix loads cpulist restriction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A recent batch of commits, one of them being:

  39115f0a826d ("rteval: Make use of systopology instead of misc in hackbench")

has made the loads modules use CpuList.expand_cpulist() (which produces a
list(int)) instead of misc.expand_cpulist() (which produces a list(str)).
However, the bits handling restricting CPU affinity based on a user
argument still expects to handle a list(str), which results in:

  [DEBUG] [kcompile] node 0 has no available cpus, removing
  [...]
  [DEBUG] [hackbench] node 0 has no available cpus, removing

Remove the leftover string casts.
Cyclictest is unaffected.

Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
---
Staring at this made me think that we might be better served by a single
Cpumask type backed by a set() and armed with string-returning methods - I
find it difficult to figure for a given CPU container if it's supposed to
be int or str-backed.

This opens up simplifying shrinking operations into e.g.:

  self.cpus[n] = self.cpus & self.cpulist

How much hate would I get for following up with something like that?
---
 rteval/modules/loads/hackbench.py | 2 +-
 rteval/modules/loads/kcompile.py  | 2 +-
 rteval/modules/loads/stressng.py  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/rteval/modules/loads/hackbench.py b/rteval/modules/loads/hackbench.py
index 538f60f..14e60d1 100644
--- a/rteval/modules/loads/hackbench.py
+++ b/rteval/modules/loads/hackbench.py
@@ -76,7 +76,7 @@ class Hackbench(CommandLineLoad):
             self.cpus[n] = sysTop.getcpus(int(n))
             # if a cpulist was specified, only allow cpus in that list on the node
             if self.cpulist:
-                self.cpus[n] = [c for c in self.cpus[n] if str(c) in expand_cpulist(self.cpulist)]
+                self.cpus[n] = [c for c in self.cpus[n] if c in expand_cpulist(self.cpulist)]
 
             # track largest number of cpus used on a node
             node_biggest = len(sysTop.getcpus(int(n)))
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index a544fd9..8de00cf 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -235,7 +235,7 @@ class Kcompile(CommandLineLoad):
 
             # if a cpulist was specified, only allow cpus in that list on the node
             if self.cpulist:
-                self.cpus[n] = [c for c in self.cpus[n] if str(c) in expand_cpulist(self.cpulist)]
+                self.cpus[n] = [c for c in self.cpus[n] if c in expand_cpulist(self.cpulist)]
 
         # remove nodes with no cpus available for running
         for node, cpus in self.cpus.items():
diff --git a/rteval/modules/loads/stressng.py b/rteval/modules/loads/stressng.py
index 287f4e2..85cb473 100644
--- a/rteval/modules/loads/stressng.py
+++ b/rteval/modules/loads/stressng.py
@@ -68,7 +68,7 @@ class Stressng(CommandLineLoad):
             cpus[n] = systop.getcpus(int(n))
             # if a cpulist was specified, only allow cpus in that list on the node
             if self.cpulist:
-                cpus[n] = [c for c in cpus[n] if str(c) in expand_cpulist(self.cpulist)]
+                cpus[n] = [c for c in cpus[n] if c in expand_cpulist(self.cpulist)]
 
         # remove nodes with no cpus available for running
         for node, cpu in cpus.items():
-- 
2.31.1




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux