Skip to content

Archlinux Kernel based on different schedulers and some other performance improvements.

linux-cachyos-rc: Drop auto-cpu-optimization.sh

Eric Naim4e7cb15e4c85
diff --git a/linux-cachyos-rc/PKGBUILD b/linux-cachyos-rc/PKGBUILD
index 5eb32262..39aeb4f8 100644
--- a/linux-cachyos-rc/PKGBUILD
+++ b/linux-cachyos-rc/PKGBUILD
@@ -75,19 +75,12 @@
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-configuring_transparent_huge_pages
: "${_hugepage:=always}"
-# CPU compiler optimizations - Defaults to prompt at kernel config if left empty
-# AMD CPUs : "k8" "k8sse3" "k10" "barcelona" "bobcat" "jaguar" "bulldozer" "piledriver" "steamroller" "excavator" "zen" "zen2" "zen3" "zen4"
-# Intel CPUs : "mpsc"(P4 & older Netburst based Xeon) "atom" "core2" "nehalem" "westmere" "silvermont" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylakex" "cannonlake" "icelake" "goldmont" "goldmontplus" "cascadelake" "cooperlake" "tigerlake" "sapphirerapids" "rocketlake" "alderlake"
-# Other options :
-# - "native_amd" (use compiler autodetection - Selecting your arch manually in the list above is recommended instead of this option)
-# - "native_intel" (use compiler autodetection and will prompt for P6_NOPS - Selecting your arch manually in the list above is recommended instead of this option)
+# CPU compiler optimizations - Defaults to native if left empty
+# - "native" (use compiler autodetection)
+# - "zen4" (Use znver4 compiler optimizations)
# - "generic" (kernel's default - to share the package between machines with different CPU µarch as long as they are x86-64)
-#
: "${_processor_opt:=}"
-# This does automatically detect your supported CPU and optimizes for it
-: "${_use_auto_optimization:=yes}"
-
# Clang LTO mode, only available with the "llvm" compiler - options are "none", "full" or "thin".
# ATTENTION - one of three predefined values should be selected!
# "full: uses 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains."
@@ -208,7 +201,6 @@ _nv_open_pkg="NVIDIA-kernel-module-source-${_nv_ver}"
source=(
"https://github.com/torvalds/linux/archive/refs/tags/v${_major}-${_rcver}.tar.gz"
"config"
- "auto-cpu-optimization.sh"
"${_patchsource}/all/0001-cachyos-base-all.patch")
# LLVM makedepends
@@ -303,20 +295,13 @@ prepare() {
if [ -n "$_processor_opt" ]; then
MARCH="${_processor_opt^^}"
- if [ "$MARCH" != "GENERIC" ]; then
- if [[ "$MARCH" =~ GENERIC_V[1-4] ]]; then
- X86_64_LEVEL="${MARCH//GENERIC_V}"
- scripts/config --set-val X86_64_VERSION "${X86_64_LEVEL}"
- else
- scripts/config -k -d CONFIG_GENERIC_CPU
- scripts/config -k -e "CONFIG_M${MARCH}"
- fi
- fi
- fi
-
- ### Use autooptimization
- if [ "$_use_auto_optimization" = "yes" ]; then
- "${srcdir}"/auto-cpu-optimization.sh
+ case "$MARCH" in
+ GENERIC_V[1-4]) scripts/config --set-val X86_64_VERSION "${MARCH//GENERIC_V}";;
+ ZEN4) scripts/config -d GENERIC_CPU -e MZEN4;;
+ NATIVE) scripts/config -d GENERIC_CPU -e X86_NATIVE_CPU;;
+ esac
+ else
+ scripts/config -d GENERIC_CPU -e X86_NATIVE_CPU
fi
### Selecting CachyOS config
diff --git a/linux-cachyos-rc/auto-cpu-optimization.sh b/linux-cachyos-rc/auto-cpu-optimization.sh
deleted file mode 100755
index 88665a08..00000000
--- a/linux-cachyos-rc/auto-cpu-optimization.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-
-# Check if GCC is installed
-check_gcc() {
- if ! [ -x "$(command -v gcc)" ]; then
- # Display error message if GCC is not installed
- echo "Error: GCC is not installed. Please install GCC and try again." >&2
- exit 1
- fi
-}
-
-# Call the function before running the rest of the script
-check_gcc
-
-# Get CPU type from GCC and convert to uppercase
-MARCH=$(gcc -Q -march=native --help=target|grep -m1 march=|awk '{print $2}')
-
-# Sync with 0005-cachy.patch using
-# sed -E '/= -march=/!d;/^[+]/!d;/CONFIG_GENERIC_CPU/d;/-march=native/d;s/.+CONFIG_M([^)]+).+-march=([^ ]+).*/\2) MARCH=\1;;/g' 0005-cachy.patch
-
-# Check for specific CPU types and set MARCH variable accordingly
-case $MARCH in
- bonnell) MARCH=ATOM;;
- k8-sse3) MARCH=K8SSE3;;
- amdfam10) MARCH=K10;;
- barcelona) MARCH=BARCELONA;;
- btver1) MARCH=BOBCAT;;
- btver2) MARCH=JAGUAR;;
- bdver1) MARCH=BULLDOZER;;
- bdver2) MARCH=PILEDRIVER;;
- bdver3) MARCH=STEAMROLLER;;
- bdver4) MARCH=EXCAVATOR;;
- znver1) MARCH=ZEN;;
- znver2) MARCH=ZEN2;;
- znver3) MARCH=ZEN3;;
- znver4) MARCH=ZEN4;;
- znver5) MARCH=ZEN5;;
- nehalem) MARCH=NEHALEM;;
- westmere) MARCH=WESTMERE;;
- silvermont) MARCH=SILVERMONT;;
- goldmont) MARCH=GOLDMONT;;
- goldmont-plus) MARCH=GOLDMONTPLUS;;
- sandybridge) MARCH=SANDYBRIDGE;;
- ivybridge) MARCH=IVYBRIDGE;;
- haswell) MARCH=HASWELL;;
- broadwell) MARCH=BROADWELL;;
- skylake) MARCH=SKYLAKE;;
- skylake-avx512) MARCH=SKYLAKEX;;
- cannonlake) MARCH=CANNONLAKE;;
- icelake-server) MARCH=ICELAKE_SERVER;;
- icelake-client) MARCH=ICELAKE_CLIENT;;
- cascadelake) MARCH=CASCADELAKE;;
- cooperlake) MARCH=COOPERLAKE;;
- tigerlake) MARCH=TIGERLAKE;;
- sapphirerapids) MARCH=SAPPHIRERAPIDS;;
- rocketlake) MARCH=ROCKETLAKE;;
- alderlake) MARCH=ALDERLAKE;;
- raptorlake) MARCH=RAPTORLAKE;;
- meteorlake) MARCH=METEORLAKE;;
- emeraldrapids) MARCH=EMERALDRAPIDS;;
-esac
-
-# If doesn't match, re-use the arch name (uppercased)
-
-# Display detected CPU and apply optimization
-echo "----------------------------------"
-echo "| APPLYING AUTO-CPU-OPTIMIZATION |"
-echo "----------------------------------"
-echo "[*] DETECTED CPU (MARCH) : ${MARCH}"
-scripts/config -k --disable CONFIG_GENERIC_CPU
-scripts/config -k --enable CONFIG_M${MARCH^^}