Signed-off-by: Ross Burton <[email protected]>
---
 .../rpm/files/less-threads.patch              | 24 +++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_4.16.1.3.bb     |  1 +
 2 files changed, 25 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/files/less-threads.patch

diff --git a/meta/recipes-devtools/rpm/files/less-threads.patch 
b/meta/recipes-devtools/rpm/files/less-threads.patch
new file mode 100644
index 0000000000..d6db85f28a
--- /dev/null
+++ b/meta/recipes-devtools/rpm/files/less-threads.patch
@@ -0,0 +1,24 @@
+Instead of telling XZ to use as many threads as there are processor cores, just
+hardcode this to 4.
+
+On large systems with lots of cores, XZ will use unreasonable amounts of 
memory.
+For example, my ThunderX2 reports 256 cores and rpmbuild takes 3.8GB of 
resident
+memory when packaging cmake. Limiting RPM to just 8 threads reduces this to
+1.2GB without massively reducing the compression speed.
+
+Upstream-Status: Inappropriate
+Signed-off-by: Ross Burton <[email protected]>
+
+diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
+index 52be6a38d..c4034e9e5 100644
+--- a/rpmio/rpmio.c
++++ b/rpmio/rpmio.c
+@@ -799,7 +799,7 @@ static LZFILE *lzopen_internal(const char *mode, int fd, 
int xz)
+ #ifdef HAVE_LZMA_MT
+           } else {
+               if (threads == -1)
+-                  threads = rpmExpandNumeric("%{getncpus}");
++                  threads = 8;
+               lzma_mt mt_options = {
+                   .flags = 0,
+                   .threads = threads,
diff --git a/meta/recipes-devtools/rpm/rpm_4.16.1.3.bb 
b/meta/recipes-devtools/rpm/rpm_4.16.1.3.bb
index 95a6f5cf71..f7e9378061 100644
--- a/meta/recipes-devtools/rpm/rpm_4.16.1.3.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.16.1.3.bb
@@ -40,6 +40,7 @@ SRC_URI = 
"git://github.com/rpm-software-management/rpm;branch=rpm-4.16.x \
            
file://0016-rpmscript.c-change-logging-level-around-scriptlets-t.patch \
            
file://0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch \
            file://0001-tools-Add-error.h-for-non-glibc-case.patch \
+           file://less-threads.patch \
            "
 
 PE = "1"
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#152261): 
https://lists.openembedded.org/g/openembedded-core/message/152261
Mute This Topic: https://lists.openembedded.org/mt/83102043/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to