teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
From 3ba0136000c986c692baab7b112aba163173d2d3 Mon Sep 17 00:00:00 2001
Message-Id: <3ba0136000c986c692baab7b112aba163173d2d3.1566556488.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 23 Aug 2019 11:09:40 +0300
Subject: [PATCH 1/2] Fix build code thread cap logic for unlimited CPUs

If there's no clear cap set from rpm configuration, just let OMP do
its own thing (ie use all available CPUs)  instead of artificially
limiting to 1.
---
 build/parseSpec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/build/parseSpec.c b/build/parseSpec.c
index 055bdf012..61858aabd 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -1036,9 +1036,8 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags,
 #ifdef ENABLE_OPENMP
     /* Set number of OMP threads centrally */
     int ncpus = rpmExpandNumeric("%{?_smp_build_ncpus}");
-    if (ncpus <= 0)
-	ncpus = 1;
-    omp_set_num_threads(ncpus);
+    if (ncpus > 0) {
+	omp_set_num_threads(ncpus);
 #endif
 
     if (spec->clean == NULL) {
-- 
2.21.0