Browse Source

Can now set the NUMA configuration of each node

Allows you to set the memory and CPU bindings for the node.
Steven Engler 4 years ago
parent
commit
4218c818ae
1 changed files with 12 additions and 2 deletions
  1. 12 2
      lib/chutney/TorNet.py

+ 12 - 2
lib/chutney/TorNet.py

@@ -880,10 +880,19 @@ class LocalNodeController(NodeController):
             return True
         tor_path = self._env['tor']
         torrc = self._getTorrcFname()
-        cmdline = [
+        cmdline = []
+        if self._env['numa_settings'] is not None:
+            (numa_node, processors) = self._env['numa_settings']
+            cmdline.extend([
+                'numactl',
+                '--membind={}'.format(numa_node),
+                '--physcpubind={}'.format(','.join(map(str, processors))),
+                ])
+        #
+        cmdline.extend([
             tor_path,
             "-f", torrc,
-            ]
+            ])
         p = launch_process(cmdline)
         if self.waitOnLaunch():
             # this requires that RunAsDaemon is set
@@ -1074,6 +1083,7 @@ DEFAULTS = {
     'sandbox': int(getenv_bool('CHUTNEY_TOR_SANDBOX',
                                platform.system() == 'Linux')),
     'num_cpus': None,
+    'numa_settings': None,
 }