From 34537bd9c7d8bffda34fcd925d6ed437681fc0cf Mon Sep 17 00:00:00 2001 From: Tino Reichardt Date: Sat, 12 Oct 2024 09:53:32 +0200 Subject: [PATCH] ZTS: Optimize Kernel Same-page Merging (KSM) Kernel same-page Merging (KSM) allows KVM guests to share identical memory pages. These shared pages are usually common libraries or other identical, high-use data. The current configuration was a bit to lazy - so KSM didn't work very well. With the new configuration I could run 3 Linux VMs in parralel. FreeBSD can't benefit from it. But FreeBSD is not so memory hungry in general, so there is no need for it ;) Reviewed-by: George Melikov Reviewed-by: Brian Behlendorf Signed-off-by: Tino Reichardt Closes #16641 --- .github/workflows/scripts/qemu-1-setup.sh | 16 +++++++++------- .github/workflows/scripts/qemu-5-setup.sh | 12 +++++++----- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/scripts/qemu-1-setup.sh b/.github/workflows/scripts/qemu-1-setup.sh index ebd80a2f9..f838da34e 100755 --- a/.github/workflows/scripts/qemu-1-setup.sh +++ b/.github/workflows/scripts/qemu-1-setup.sh @@ -18,19 +18,21 @@ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N "" # we expect RAM shortage cat << EOF | sudo tee /etc/ksmtuned.conf > /dev/null +# /etc/ksmtuned.conf - Configuration file for ksmtuned # https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/chap-ksm KSM_MONITOR_INTERVAL=60 # Millisecond sleep between ksm scans for 16Gb server. # Smaller servers sleep more, bigger sleep less. -KSM_SLEEP_MSEC=10 -KSM_NPAGES_BOOST=300 -KSM_NPAGES_DECAY=-50 -KSM_NPAGES_MIN=64 -KSM_NPAGES_MAX=2048 +KSM_SLEEP_MSEC=30 -KSM_THRES_COEF=25 -KSM_THRES_CONST=2048 +KSM_NPAGES_BOOST=0 +KSM_NPAGES_DECAY=0 +KSM_NPAGES_MIN=1000 +KSM_NPAGES_MAX=25000 + +KSM_THRES_COEF=80 +KSM_THRES_CONST=8192 LOGFILE=/var/log/ksmtuned.log DEBUG=1 diff --git a/.github/workflows/scripts/qemu-5-setup.sh b/.github/workflows/scripts/qemu-5-setup.sh index 7acb67a27..5034c1896 100755 --- a/.github/workflows/scripts/qemu-5-setup.sh +++ b/.github/workflows/scripts/qemu-5-setup.sh @@ -14,17 +14,19 @@ PID=$(pidof /usr/bin/qemu-system-x86_64) tail --pid=$PID -f /dev/null sudo virsh undefine openzfs +# default values per test vm: +VMs=2 +CPU=2 + # definitions of per operating system case "$OS" in + # FreeBSD can't be optimized via ksmtuned freebsd*) - VMs=2 - CPU=3 RAM=6 ;; *) - VMs=2 - CPU=3 - RAM=7 + # Linux can be optimized via ksmtuned + RAM=8 ;; esac