From 620fa54d0201919e900b117407322e162632f7bf Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Mon, 4 Nov 2019 16:22:01 -0800 Subject: [PATCH] reproducible: Reduce parallelism on armhf systems with a lot of cores to reduce swapping on highly parallel builds. Also ensure parallelism for armhf is an odd number on first build, and even on second build. --- bin/reproducible_build.sh | 19 ++++++++++++++++++- bin/reproducible_common.sh | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index b54cb2b8..efa24c9a 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -568,6 +568,15 @@ first_build() { echo "Date: $(date)" echo "Date UTC: $(date -u)" echo "=============================================================================" + if [ "${ARCH}" = "armhf" ]; then + # Reduce parallelism on armhf systems with a lot of cores to + # reduce swapping on highly parallel builds. Also ensure first + # build is always an odd number of CPUs for good measure. + case $NUM_CPU in + 2|4) NUM_CPU=3 ;; + *) NUM_CPU=5 ;; + esac + fi local TMPCFG=$(mktemp -t pbuilderrc_XXXX --tmpdir=$TMPDIR) cat > "$TMPCFG" << EOF BUILDUSERID=1111 @@ -625,7 +634,15 @@ second_build() { echo "=============================================================================" set -x local TMPCFG=$(mktemp -t pbuilderrc_XXXX --tmpdir=$TMPDIR) - NEW_NUM_CPU=$NUM_CPU # on amd64+i386 we vary this based on node choices (by design), on armhf only sometimes. + # on amd64+i386 we vary this based on node choices (by design) + if [ "${ARCH}" = "armhf" ]; then + # Reduce parallelism on armhf systems with a lot of cores to + # reduce swapping on highly parallel builds. Keep second build + # with even number of cores. + case $NUM_CPU in + 8) NUM_CPU=6 ;; + esac + fi # differ locale+language depending on the architecture (mostly for readability by different people…) case $ARCH in armhf) locale=it_CH diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index 3a3df370..0e84a190 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -494,7 +494,7 @@ write_variation_table() { write_page "build path/build/1st/\$pkg-\$ver (not varied for stretch/buster)/build/2/\$pkg-\$ver/2nd (not varied for stretch/buster)" write_page "user's login shell/bin/sh/bin/bash" write_page "user's GECOSfirst user,first room,first work-phone,first home-phone,first othersecond user,second room,second work-phone,second home-phone,second other" - write_page "env DEB_BUILD_OPTIONSDEB_BUILD_OPTIONS=\"parallel=XXX\"
  XXX on amd64: 16 or 15
  XXX on i386: 10 or 9
  XXX on armhf: 8, 4 or 2DEB_BUILD_OPTIONS=\"parallel=YYY\"
  YYY on amd64: 16 or 15 (!= the first build)
  YYY on i386: 10 or 9 (!= the first build)
  YYY is the same as XXX on arm64
  YYY on armhf: 8, 4, or 2 (not varied systematically)" + write_page "env DEB_BUILD_OPTIONSDEB_BUILD_OPTIONS=\"parallel=XXX\"
  XXX on amd64: 16 or 15
  XXX on i386: 10 or 9
  XXX on armhf: 5 or 3DEB_BUILD_OPTIONS=\"parallel=YYY\"
  YYY on amd64: 16 or 15 (!= the first build)
  YYY on i386: 10 or 9 (!= the first build)
  YYY is the same as XXX on arm64
  YYY on armhf: 2, 4, or 6" write_page "UTS namespaceshared with the hostmodified using /usr/bin/unshare --uts" elif [ "$1" = "Arch Linux" ] ; then write_page "env USERjenkinsbuild 2" -- GitLab