If _NR_CPUS_value isn't set or empty, prompt about using the current host's threads count.

This commit is contained in:
Tk-Glitch
2022-08-12 18:41:20 +02:00
parent 16919b3ce0
commit c4de67201c
2 changed files with 15 additions and 1 deletions

View File

@@ -254,7 +254,7 @@ _kernel_localversion=""
# Set to "true" to add back missing symbol for AES-NI/AVX support on ZFS - This is a legacy option that can be ignored on 5.10+ kernels - https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions.patch
_zfsfix="true"
# Set to your maximum number of CPUs (physical + logical cores) - Lower means less overhead - You can set it to "$(nproc)" to use the current host's CPU(s) core count
# Set to your maximum number of CPUs (physical + logical cores) - Lower means less overhead - You can set it to "$(nproc)" to use the current host's CPU(s) core count, or leave empty to get a prompt
# If you set this to a lower value than you have cores, some cores will be disabled
# Default Arch kernel value is 320
_NR_CPUS_value="128"

View File

@@ -1394,6 +1394,20 @@ CONFIG_DEBUG_INFO_BTF_MODULES=y\r
fi
fi
# NR_CPUS
if [ -z "$_NR_CPUS_value" ]; then
plain ""
plain "Set NR_CPUS value to the current host's threads count?"
plain "For best results, it should be equal to the maximum number of threads the target machine has."
plain "If you want to use the resulting kernel on a machine with more threads, you can hit enter or answer N to use a default of 128."
read -rp "`echo $' > N/y : '`" CONDITION_nrcpus;
fi
if [[ "$CONDITION_nrcpus" =~ [yY] ]] || [ -n "$_NR_CPUS_value" ]; then
scripts/config --set-val "$_NR_CPUS_value"
else
scripts/config --set-val "128"
fi
fi
# Community patches