[PATCH] kunit: tool: Default --jobs to number of CPUs

From: David Gow
Date: Sat Dec 11 2021 - 03:49:44 EST


The --jobs parameter for kunit_tool currently defaults to 8 CPUs,
regardless of the number available. For systems with significantly more
(or less), this is not as efficient. Instead, default --jobs to the
number of CPUs present in the system: while there are as many
superstitions as to exactly what the ideal jobs:CPU ratio is, this seems
sufficiently sensible to me.

Signed-off-by: David Gow <davidgow@xxxxxxxxxx>
---
tools/testing/kunit/kunit.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index 68e6f461c758..2cb6c7db5683 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -310,7 +310,7 @@ def add_build_opts(parser) -> None:
parser.add_argument('--jobs',
help='As in the make command, "Specifies the number of '
'jobs (commands) to run simultaneously."',
- type=int, default=8, metavar='jobs')
+ type=int, default=os.cpu_count(), metavar='jobs')

def add_exec_opts(parser) -> None:
parser.add_argument('--timeout',
--
2.34.1.173.g76aa8bc2d0-goog