- Switch to memory-constraints macros to limit threads as needed

- Enable LTO on libreoffice, 16% smaller binaries, less memory used:
  * 0001-Use-jobserver-on-LTO-from-make.patch

OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=629
This commit is contained in:
Tomáš Chvátal 2018-04-06 14:52:02 +00:00 committed by Git OBS Bridge
parent 85b0bc9d1d
commit c311a43449
3 changed files with 47 additions and 18 deletions

View File

@ -0,0 +1,33 @@
From c87570aad9f4675f2bba9233f12f53d9fa287c51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
Date: Fri, 6 Apr 2018 16:33:39 +0200
Subject: [PATCH] Use jobserver on LTO from make
This should avoid executing PARALELISM threads for each linker call but
rather limits it to the basic jobs given to make.
Previous behaviour could be 8 make threads, each spawning 8 LTO threads,
while here it should append its jobs to make and leave it to the make
itself to distribute.
Change-Id: Ib22bd21dfae60eb0eb8ac7b9c1c277b152378294
---
solenv/gbuild/platform/com_GCC_defs.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index ac3cbc366cf7..4180144bdec4 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -158,7 +158,7 @@ ifeq ($(COM_IS_CLANG),TRUE)
gb_LTOFLAGS := -flto
gb_LTOPLUGINFLAGS := --plugin LLVMgold.so
else
-gb_LTOFLAGS := -flto=$(PARALLELISM) -fuse-linker-plugin -O2
+gb_LTOFLAGS := -flto=jobserver -fuse-linker-plugin -O2
endif
endif
--
2.16.3

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Apr 6 14:27:40 UTC 2018 - tchvatal@suse.com
- Switch to memory-constraints macros to limit threads as needed
- Enable LTO on libreoffice, 16% smaller binaries, less memory used:
* 0001-Use-jobserver-on-LTO-from-make.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Apr 3 12:26:41 UTC 2018 - tchvatal@suse.com Tue Apr 3 12:26:41 UTC 2018 - tchvatal@suse.com

View File

@ -97,6 +97,8 @@ Patch5: 0001-Use-PYTHON_FOR_BUILD-instead-of-calling-python-direc.patch
Patch7: bnc1039203.patch Patch7: bnc1039203.patch
# LO-L3: Slide with chart has some strange (too large?) elements (PPTX) # LO-L3: Slide with chart has some strange (too large?) elements (PPTX)
Patch8: bnc1060128.patch Patch8: bnc1060128.patch
# Upstream! this uses jobserver instead of PARALELISM for LTO
Patch9: 0001-Use-jobserver-on-LTO-from-make.patch
# try to save space by using hardlinks # try to save space by using hardlinks
Patch990: install-with-hardlinks.diff Patch990: install-with-hardlinks.diff
BuildRequires: %{name}-share-linker BuildRequires: %{name}-share-linker
@ -140,6 +142,7 @@ BuildRequires: libserializer
BuildRequires: libtool BuildRequires: libtool
BuildRequires: lpsolve-devel BuildRequires: lpsolve-devel
BuildRequires: make BuildRequires: make
BuildRequires: memory-constraints
BuildRequires: neon-devel >= 0.26.0 BuildRequires: neon-devel >= 0.26.0
BuildRequires: openldap2-devel BuildRequires: openldap2-devel
BuildRequires: pentaho-libxml BuildRequires: pentaho-libxml
@ -883,6 +886,7 @@ Provides additional %{langname} translations and resources for %{project}. \
%patch5 -p1 %patch5 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
%patch9 -p1
%patch990 -p1 %patch990 -p1
# Disable some of the failing tests (some are random) # Disable some of the failing tests (some are random)
@ -913,23 +917,7 @@ lo_jobs="%{?jobs:%{jobs}}"
%endif %endif
%endif %endif
# do not eat all memory # do not eat all memory
echo "Available memory:" %limit_build -m 1200
cat /proc/meminfo
echo "System limits:"
ulimit -a
lo_jobs_reduced=
if test -n "$lo_jobs" -a "$lo_jobs" -gt 1 ; then
mem_per_process=1200000
max_mem=$(awk '/MemTotal/ { print $2 }' /proc/meminfo)
max_jobs="$(($max_mem / $mem_per_process))"
test "$lo_jobs" -gt "$max_jobs" && lo_jobs="$max_jobs" && lo_jobs_reduced="yes" && echo "Warning: Reducing number of jobs to $max_jobs because of memory limits"
test "$lo_jobs" -le 0 && lo_jobs=1 && echo "Warning: Do not use the parallel build at all becuse of memory limits"
fi
# finally set jobs
PARALLEL_BUILD=
if test -n "$lo_jobs" ; then
PARALLEL_BUILD="--with-parallelism=$lo_jobs"
fi
# make sure that JAVA_HOME is set correctly # make sure that JAVA_HOME is set correctly
source %{_sysconfdir}/profile.d/alljava.sh source %{_sysconfdir}/profile.d/alljava.sh
# use RPM_OPT_FLAGS, ... # use RPM_OPT_FLAGS, ...
@ -954,8 +942,9 @@ google_default_client_secret="KDTRKEZk2jwT_7CDpcmMA--P"
export NOCONFIGURE=yes export NOCONFIGURE=yes
./autogen.sh ./autogen.sh
%configure \ %configure \
$PARALLEL_BUILD \ --with-parallelism=%{jobs} \
--enable-eot \ --enable-eot \
--enable-lto \
--enable-mergelibs \ --enable-mergelibs \
--docdir=%{_docdir}/%{name} \ --docdir=%{_docdir}/%{name} \
--with-compat-oowrappers \ --with-compat-oowrappers \