misc: rework latest changes

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-06-19 23:26:51 +02:00
parent 64f7bc5d29
commit e2b35dea64
2 changed files with 18 additions and 25 deletions

View File

@ -10,18 +10,12 @@ PLATFORM="$(/bin/get_key_value /etc.defaults/synoinfo.conf unique | cut -d"_" -f
CPUCORE=$(cat /proc/cpuinfo 2>/dev/null | grep processor | wc -l)
while true; do
CPUCORE=$((CPUCORE - 1))
if [ "${PLATFORM}" == "eypc7002" ]; then
if grep -qw "schedutil" /sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_available_governors; then
echo "schedutil" >/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_available_governors
else
echo "performance" >/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_available_governors
fi
if [ "${PLATFORM}" = "epyc7002" ]; then
echo "schedutil" >"/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_governor"
echo "set schedutil governor for ${PLATFORM} cpu: ${CPUCORE}"
else
if grep -qw "ondemand" /sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_available_governors; then
echo "ondemand" >/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_available_governors
else
echo "performance" >/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_available_governors
fi
echo "ondemand" >"/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_governor"
echo "set ondemand governor for ${PLATFORM} cpu: ${CPUCORE}"
fi
if [ ${CPUCORE} -eq 0 ]; then
break

View File

@ -139,20 +139,19 @@ elif [ "${1}" = "late" ]; then
mkdir -p "/tmpRoot/usr/lib/systemd/system"
DEST="/tmpRoot/usr/lib/systemd/system/governor.service"
echo "[Unit]" >${DEST}
echo "Description=Set CPU Governor" >>${DEST}
echo "DefaultDependencies=no" >>${DEST}
echo "IgnoreOnIsolate=true" >>${DEST}
echo "After=multi-user.target" >>${DEST}
echo >>${DEST}
echo "[Service]" >>${DEST}
echo "User=root" >>${DEST}
echo "Restart=always" >>${DEST}
echo "RestartSec=30" >>${DEST}
echo "ExecStart=/usr/sbin/governor.sh" >>${DEST}
echo >>${DEST}
echo "[X-Synology]" >>${DEST}
echo "Author=Virtualization Team" >>${DEST}
echo "[Unit]" >${DEST}
echo "Description=Set CPU Governor" >>${DEST}
echo "DefaultDependencies=no" >>${DEST}
echo "IgnoreOnIsolate=true" >>${DEST}
echo "After=multi-user.target" >>${DEST}
echo >>${DEST}
echo "[Service]" >>${DEST}
echo "Type=oneshot" >>${DEST}
echo "RemainAfterExit=yes" >>${DEST}
echo "ExecStart=/usr/sbin/governor.sh" >>${DEST}
echo >>${DEST}
echo "[X-Synology]" >>${DEST}
echo "Author=Virtualization Team" >>${DEST}
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
ln -vsf /usr/lib/systemd/system/governor.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/governor.service