Fully replace Armbian's former limited utilization of cpufrequtils package

This commit is contained in:
Thomas Kaiser
2024-04-20 10:46:23 +02:00
committed by Igor
parent 71bd6633c6
commit 26dec02ea1

View File

@@ -69,18 +69,29 @@ prepare_board() {
find /etc/logrotate.d/. -type f | xargs grep -H -c 'compress' | grep 0$ | cut -d':' -f1 | xargs -r -L1 sed -i '/{/ a compress'
sed -i "s/#compress/compress/" /etc/logrotate.conf
# Fully replace Armbian's former limited utilization of cpufrequtils package
if [ -r /etc/default/cpufrequtils ] ; then
. /etc/default/cpufrequtils
for Cluster in /sys/devices/system/cpu/cpufreq/policy* ; do
[[ -e "${Cluster}" ]] || break
grep -q "${GOVERNOR}" "${Cluster}/scaling_available_governors" && [ -w "${Cluster}/scaling_governor" ] && echo "${GOVERNOR}" >"${Cluster}/scaling_governor"
[ "X${MIN_SPEED}" != "X" ] && [ -w "${Cluster}/scaling_min_freq" ] && echo "${MIN_SPEED}" >"${Cluster}/scaling_min_freq"
[ "X${MAX_SPEED}" != "X" ] && [ -w "${Cluster}/scaling_max_freq" ] && echo "${MAX_SPEED}" >"${Cluster}/scaling_max_freq"
done
fi
# Tweak ondemand cpufreq governor settings to increase cpufreq with IO load.
# Don't check what Armbian wants to set, simply honor ondemand being used and
# then tweak
cd /sys/devices/system/cpu
for i in cpufreq/ondemand cpu[0-9]/cpufreq/ondemand cpu[1-9][0-9]/cpufreq/ondemand; do
if [ -d $i ]; then
echo 1 > ${i}/io_is_busy
echo 25 > ${i}/up_threshold
echo 10 > ${i}/sampling_down_factor
echo 200000 > ${i}/sampling_rate
fi
done
if [ "X${GOVERNOR}" = "Xondemand" ]; then
cd /sys/devices/system/cpu
for i in cpufreq/ondemand cpu[0-9]/cpufreq/ondemand cpu[1-9][0-9]/cpufreq/ondemand; do
if [ -d $i ]; then
echo 1 > ${i}/io_is_busy
echo 25 > ${i}/up_threshold
echo 10 > ${i}/sampling_down_factor
echo 200000 > ${i}/sampling_rate
fi
done
fi
# IRQ distribution based on $BOARDFAMILY and/or $BOARD_NAME
case ${BOARD} in