From fbc9017595bb4680094227aadfcb68644cbdc73c Mon Sep 17 00:00:00 2001
From: Steve Fink <sfink@mozilla.com>
Date: Thu, 1 Jun 2023 16:45:37 +0000
Subject: [PATCH] Bug 1638045 - Allow parallel jit-tests to run up to 8-way on
 Windows r=spidermonkey-reviewers,jonco,mgaudet

Differential Revision: https://phabricator.services.mozilla.com/D179702
---
 js/src/devtools/automation/autospider.py | 25 ++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/js/src/devtools/automation/autospider.py b/js/src/devtools/automation/autospider.py
index a76ee0344d6e6..66e25e2078189 100755
--- a/js/src/devtools/automation/autospider.py
+++ b/js/src/devtools/automation/autospider.py
@@ -547,21 +547,30 @@ test_suites -= set(normalize_tests(args.skip_tests.split(",")))
 if "all" in args.skip_tests.split(","):
     test_suites = []
 
-# Bug 1391877 - Windows test runs are getting mysterious timeouts when run
-# through taskcluster, but only when running multiple jit-test jobs in
-# parallel. Work around them for now.
-if platform.system() == "Windows":
-    env["JITTEST_EXTRA_ARGS"] = "-j1 " + env.get("JITTEST_EXTRA_ARGS", "")
-
 # Bug 1557130 - Atomics tests can create many additional threads which can
 # lead to resource exhaustion, resulting in intermittent failures. This was
 # only seen on beefy machines (> 32 cores), so limit the number of parallel
 # workers for now.
+#
+# Bug 1391877 - Windows test runs are getting mysterious timeouts when run
+# through taskcluster, but only when running many jit-test jobs in parallel.
+# Even at 16, some tests can overflow the paging file.
+worker_max = multiprocessing.cpu_count()
+jstest_workers = worker_max
+jittest_workers = worker_max
 if platform.system() == "Windows":
-    worker_count = min(multiprocessing.cpu_count(), 16)
-    env["JSTESTS_EXTRA_ARGS"] = "-j{} ".format(worker_count) + env.get(
+    jstest_workers = min(worker_max, 16)
+    env["JSTESTS_EXTRA_ARGS"] = "-j{} ".format(jstest_workers) + env.get(
         "JSTESTS_EXTRA_ARGS", ""
     )
+    jittest_workers = min(worker_max, 8)
+    env["JITTEST_EXTRA_ARGS"] = "-j{} ".format(jittest_workers) + env.get(
+        "JITTEST_EXTRA_ARGS", ""
+    )
+print(
+    f"using {jstest_workers}/{worker_max} workers for jstests, "
+    f"{jittest_workers}/{worker_max} for jittest"
+)
 
 if use_minidump:
     # Set up later js invocations to run with the breakpad injector loaded.
-- 
GitLab