d678a6a69f
Also drop %_lto_cflags macro (reverted upstream) before people start adapting its use.
63 lines
2.2 KiB
Diff
63 lines
2.2 KiB
Diff
From bcaa30872087a1002648653358ab9514f829de9a Mon Sep 17 00:00:00 2001
|
|
Message-Id: <bcaa30872087a1002648653358ab9514f829de9a.1566556488.git.pmatilai@redhat.com>
|
|
In-Reply-To: <3ba0136000c986c692baab7b112aba163173d2d3.1566556488.git.pmatilai@redhat.com>
|
|
References: <3ba0136000c986c692baab7b112aba163173d2d3.1566556488.git.pmatilai@redhat.com>
|
|
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Date: Fri, 23 Aug 2019 11:17:21 +0300
|
|
Subject: [PATCH 2/2] Cap number of threads on 32bit platforms, add a tunable
|
|
(RhBug:1729382)
|
|
|
|
On 32bit plaforms, address space is easily exhausted with multiple
|
|
threads, causing arbitrary builds failure regressions (RhBug:1729382).
|
|
Simply cap the number of threads to maximum of four on any 32bit
|
|
platform to play it safe. It's still three more than we were able to
|
|
use on older releases...
|
|
|
|
In addition, introduce a separate tunable for tweaking the maximum
|
|
number of threads just in case, defaulting to max CPUs available.
|
|
---
|
|
build/parseSpec.c | 10 +++++++++-
|
|
platform.in | 3 +++
|
|
2 files changed, 12 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/build/parseSpec.c b/build/parseSpec.c
|
|
index 61858aabd..d987bdc7b 100644
|
|
--- a/build/parseSpec.c
|
|
+++ b/build/parseSpec.c
|
|
@@ -1035,9 +1035,17 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags,
|
|
|
|
#ifdef ENABLE_OPENMP
|
|
/* Set number of OMP threads centrally */
|
|
- int ncpus = rpmExpandNumeric("%{?_smp_build_ncpus}");
|
|
+ int ncpus = rpmExpandNumeric("%{?_smp_nthreads_max}");
|
|
+#if __WORDSIZE == 32
|
|
+ /* On 32bit platforms, address space shortage is an issue. Play safe. */
|
|
+ if (ncpus <= 0 || ncpus > 4) {
|
|
+ ncpus = 4;
|
|
+ rpmlog(RPMLOG_DEBUG,
|
|
+ "limiting number of threads to %d due to platform\n", ncpus);
|
|
+ }
|
|
if (ncpus > 0) {
|
|
omp_set_num_threads(ncpus);
|
|
+#endif
|
|
#endif
|
|
|
|
if (spec->clean == NULL) {
|
|
diff --git a/platform.in b/platform.in
|
|
index db6d2382f..c70f44193 100644
|
|
--- a/platform.in
|
|
+++ b/platform.in
|
|
@@ -59,6 +59,9 @@
|
|
|
|
%_smp_mflags -j%{_smp_build_ncpus}
|
|
|
|
+# Maximum number of CPU's to use for threads
|
|
+%_smp_nthreads_max %{_smp_build_ncpus}
|
|
+
|
|
#==============================================================================
|
|
# ---- Build policy macros.
|
|
#
|
|
--
|
|
2.21.0
|
|
|