Don't set too high number of workers

This commit is contained in:
Kron4ek 2021-08-07 23:20:15 +05:00 committed by GitHub
parent 260c740feb
commit 22e6270f62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,7 +43,7 @@ mount_point="${working_dir}"/mnt
# a problem with mounting the image due to an incorrectly calculated offset.
# The size of this script
scriptsize=22365
scriptsize=22514
# The size of the utils.tar.gz archive
# utils.tar.gz contains bwrap, squashfuse and dwarfs binaries
@ -191,6 +191,7 @@ if [ "${SUDO_MOUNT}" != 1 ] || [ "${dwarfs_image}" = 1 ]; then
fi
# Set the dwarfs block cache size depending on how much RAM is available
# Also set the number of workers depending on the number of CPU cores
if [ "${dwarfs_image}" = 1 ]; then
if getconf _PHYS_PAGES &>/dev/null && getconf PAGE_SIZE &>/dev/null; then
memory_size="$(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / (1024 * 1024)))"
@ -212,6 +213,10 @@ if [ "${dwarfs_image}" = 1 ]; then
if getconf _NPROCESSORS_ONLN &>/dev/null; then
dwarfs_num_workers="$(getconf _NPROCESSORS_ONLN)"
if [ "${dwarfs_num_workers}" -ge 16 ]; then
dwarfs_num_workers=16
fi
fi
fi