Skip to content
15 changes: 12 additions & 3 deletions .update/version
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ G_MIN_DEBIAN=6
# Alternative Git branch to automatically migrate to when Debian version is too low
G_OLD_DEBIAN_BRANCH='8'
# Live patches
G_LIVE_PATCH_DESC=()
G_LIVE_PATCH_COND=()
G_LIVE_PATCH=()
G_LIVE_PATCH_DESC=(
[0]='Fix Docker socket path for Portainer installation, only relevant if you plan to install/reinstall/update Portainer via dietpi-software'
[1]='Fix CPU frequency limit selection in dietpi-config'
)
G_LIVE_PATCH_COND=(
[0]='grep -q '\''/run/docker.sock:/run/docker.sock'\'' /boot/dietpi/dietpi-software'
[1]='grep -q '\''\[0-9\]\*scaling_available_frequencies'\'' /boot/dietpi/dietpi-config'
)
G_LIVE_PATCH=(
[0]='sed --follow-symlinks -i '\''s|/run/docker.sock:/run/docker.sock|/run/docker.sock:/var/run/docker.sock|'\'' /boot/dietpi/dietpi-software'
[1]='sed --follow-symlinks -i '\''s|\[0-9\]\*scaling_available_frequencies|\[0-9\]\*/scaling_available_frequencies|'\'' /boot/dietpi/dietpi-config'
)
5 changes: 4 additions & 1 deletion dietpi/dietpi-cpuinfo
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
{
for ((i=0; i<$G_HW_CPU_CORES; i++))
do
[[ -f /sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq ]] && read -r aCPU_CUR_FREQ["$i"] < "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq"
[[ -f /sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq ]] && {
sleep 0.05 # Necessary to give the scheduler a chance to scale down the core in (quite likely) case this script has already caused it to ramp up the frequency
Copy link
Owner

@MichaIng MichaIng Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sleep 0.05 # Necessary to give the scheduler a chance to scale down the core in (quite likely) case this script has already caused it to ramp up the frequency
G_SLEEP 0.05 # Necessary to give the scheduler a chance to scale down the core in (quite likely) case this script has already caused it to ramp up the frequency

/bin/sleep is an external executable, expensive to call. We have a G_SLEEP function which provides the functionality very cheaply with pure shell features. This also reduces the processing for the sleep call itself significantly.

read -r aCPU_CUR_FREQ["$i"] < "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq"
}
[[ -f /sys/devices/system/cpu/cpu$i/cpufreq/scaling_min_freq ]] && read -r aCPU_MIN_FREQ["$i"] < "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_min_freq"
[[ -f /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq ]] && read -r aCPU_MAX_FREQ["$i"] < "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
done
Expand Down