Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

5.4.60 uksm doesn't save the memory for KVM images #82

Open
hailumeng opened this issue Jul 27, 2022 · 6 comments
Open

5.4.60 uksm doesn't save the memory for KVM images #82

hailumeng opened this issue Jul 27, 2022 · 6 comments

Comments

@hailumeng
Copy link

hailumeng commented Jul 27, 2022

I have launched 4 same type of KVM images in Ubuntu 20.04 patched with 5.4.60 uksm. The memory saving is only 4%. Tested with other different KVM images, the saving is around 50%. I also find out the non-working KVM does use 5.15.38 kernel. Maybe I need Ubuntu 22.04 to host this KVM with uksm-5.15.patch? Any guidance? Thank you.

@bhzhu203
Copy link

You could disable memory randomize in newly kernel

echo 0 > /proc/sys/kernel/randomize_va_space

@hailumeng
Copy link
Author

Thank you bhzhu203 for the advice here. Before I give it a try, do you have any other recommendations for tuning? The reason I’m asking is the guest VM I have uses 18G memory each. When testing with them, the saving is much less compared to the VM which only has 4 or 8G memory. I wonder if I need to tune uksm to work on big memory VM. Thoughts? Thank you!

@bhzhu203
Copy link

bhzhu203 commented Aug 5, 2022

Thank you bhzhu203 for the advice here. Before I give it a try, do you have any other recommendations for tuning? The reason I’m asking is the guest VM I have uses 18G memory each. When testing with them, the saving is much less compared to the VM which only has 4 or 8G memory. I wonder if I need to tune uksm to work on big memory VM. Thoughts? Thank you!

You could try to use zram and save some memory of cache (compresion)

echo 3G >  /sys/block/zram0/disksize
mkswap  /dev/zram0
swapon --priority 100 /dev/zram0

cat /sys/block/zram0/comp_algorithm
lzo [lzo-rle] lz4 lz4hc 842 zstd (lzo-rle better)

#then flush the cache quickly

cat /etc/sysctl.conf

vm.min_free_kbytes=162164 # 1% total memory in M
vm.dirty_background_ratio=5
vm.dirty_ratio = 10
vm.dirty_expire_centisecs = 1500
vm.dirty_writeback_centisecs = 300
vm.vfs_cache_pressure=150
vm.swappiness=85

@bhzhu203
Copy link

bhzhu203 commented Aug 5, 2022

how about the randomize_va_space option now?

@hailumeng
Copy link
Author

hailumeng commented Aug 5, 2022 via email

@hailumeng
Copy link
Author

hailumeng commented Aug 5, 2022 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants