python-linux-procfs: Parse the number of cpus correctly on s390(x)

Getting the number of cpus breaks on s390 and s390x due to differences
in /proc/cpuinfo

This can cause problems in other programs such as tuna when running
tuna --cpus=1 --isolate
for example

Fix this by testing whether we are on s390 and increasing the cpu count
if we match "cpu number"

Signed-off-by: John Kacur <>
diff --git a/procfs/ b/procfs/
index ccf4ea1..a586ae2 100755
--- a/procfs/
+++ b/procfs/
@@ -22,9 +22,18 @@
 from functools import reduce
 from six.moves import range
 from utilist import bitmasklist
+import platform
+import re
 VERSION = "0.5"
+def is_s390():
+    machine = platform.machine()
+    if's390', machine):
+        return True
+    else:
+        return False
 def process_cmdline(pid_info):
     Returns the process command line, if available in the given `process' class, if
@@ -807,6 +816,9 @@
             if tagname == "processor":
                 self.nr_cpus += 1
+            elif is_s390() and tagname == "cpu number":
+                self.nr_cpus += 1
+                continue
             elif tagname == "core id":
             self.tags[tagname] = fields[1].strip()