Skip to content

Commit 169858b

Browse files
committed
fix: Add Minimum-free ZRAM configuration
It assures that this value will get properly configured for systems with ≥6.75GBs of RAM. As this article shows, too low of a value is not good, and too high of a value is not good. https://linuxhint.com/vm_min_free_kbytes_sysctl/ It is the only remaining non-applied ZRAM tweak from Pop-OS, which they included in their zram service. pop-os/default-settings@7fcad35#diff-964fc7d24025670fb776c01ef2943c84e637a3675c164696aebae19d86c8d46eR62 This checks if minimum-free ZRAM value is 1% of the maximum RAM of the current system, hence why this must go to the hardware service compared to simple sysctl config change.
1 parent dfa8e97 commit 169858b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

system_files/desktop/shared/usr/bin/bazzite-hardware-setup

+12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ fi
3535
# GLOBAL
3636
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
3737
GPU_ID=$(lspci -k | grep -A 3 -E "(VGA|3D)")
38+
MINIMUM_FREE_ZRAM=$(awk '/MemTotal/ {printf "%.0f", $2 * 0.01}' /proc/meminfo)
39+
CURRENT_FREE_ZRAM=$(sysctl vm.min_free_kbytes | awk '{print $3}')
3840
KARGS=$(rpm-ostree kargs)
3941
NEEDED_KARGS=()
4042
INITRAMFS=$(rpm-ostree initramfs)
@@ -143,6 +145,16 @@ else
143145
echo "No fstab param adjustments needed"
144146
fi
145147

148+
# ZRAM MINIMUM-FREE CONFIGURATION
149+
echo "Current minimum-free ZRAM value: $CURRENT_FREE_ZRAM"
150+
151+
if ((MINIMUM_FREE_ZRAM > CURRENT_FREE_ZRAM)); then
152+
sysctl -w "vm.min_free_kbytes=${MINIMUM_FREE_ZRAM}"
153+
echo "Found needed minimum-free ZRAM changes, applying the following: ${MINIMUM_FREE_ZRAM}"
154+
else
155+
echo "No minimum-free ZRAM changes needed"
156+
fi
157+
146158
# HOSTNAME FIX
147159
# If the hostname is too long Distrobox will fail during setup
148160
# Additonally, Anaconda likes to set the hostname to be the ipv6 address

0 commit comments

Comments
 (0)