[Memory Deduplication] Implement New Technology to Incus

Unfortunately, I’m not sure how to modify the systemd configuration in each container. However, I got the idea from this post and tried the following:

root@ksm:/home/ubuntu# LD_PRELOAD=/home/ubuntu/enable_ksm.so /usr/libexec/incus/incusd --group incus-admin

After launching 10 Ubuntu 24.04 containers, I saved only 4 megabytes of RAM:

root@ksm:/home/ubuntu# echo $[$(cat /sys/kernel/mm/ksm/pages_sharing)*$(getconf PAGE_SIZE)/1024 ]KB
4744KB

Each container consumes about 22 megabytes of RAM:

root@ksm:/home/ubuntu# incus info u10 | grep Memory
Memory usage:
Memory (current): 22.95MiB

I appreciate your help!

Regards.