On 18/05/2021 10.41, Paolo Bonzini wrote:
I could not reconstruct the origin of the $(($(nproc) + 1)) idiom,
but I suspect it was there only to have a sensible result when nproc
or getconf do not exist.  This can be achieved also with an "||".

Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
  .gitlab-ci.yml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4bd1a91aa8..3f0d86cf0a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,7 +17,7 @@ include:
    stage: build
    image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
    before_script:
-    - JOBS=$(expr $(nproc) + 1)
+    - JOBS=$(nproc || echo 1)

The basic idea of the "+ 1" was to make sure that there is always a thread that runs on a CPU while maybe another one is waiting for I/O to complete. This is suggested by various sites on the web, e.g.:


https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command

So not sure whether this patch here make sense ... I'd rather drop it.

 Thomas


Reply via email to