We are running Oracle Linux 8.10 KVM and We are observing that memory over-provisioning behaves statically — KVM reserves approximately one-third of the guest memory at launch, and no any dynamic memory reclamation or redistribution.
Whether Oracle KVM (standalone, without OLVM) currently supports any form of dynamic memory allocation or automatic reclamation?
Autodeflate option.
This feature allows the QEMU VirtIO memory balloon device to release memory just before a guest process would otherwise be terminated by the Out-of-Memory (OOM) killer.
====
The optional autodeflate attribute allows to enable/disable (values “on”/”off”, respectively) the ability of the QEMU virtio memory balloon to release some memory at the last moment before a guest’s process get killed by Out of Memory killer.
====
Ref: https://libvirt.org/formatdomain.html
1. The Difference
**Hyper-V (Dynamic Memory):** The VM says “I need more RAM,” and the Host gives it automatically (up to the limit).
**KVM (Memory Ballooning):** The Host says “I need that RAM back,” and takes it from the VM.
*Key Takeaway:* KVM’s dynamic memory tools (Ballooning) are designed primarily to **save memory for the Host**, not to automatically **give memory to the Guest**
2. How “On-Demand” works in KVM
If you want a Windows VM to start small (e.g., 4GB) but grow if needed (e.g., to 16GB), KVM requires a **manual trigger** or a specific configuration. It does not happen automatically just because Windows is busy.
To achieve this, you use **Memory Hot-Plug**:
**Configure limits:** Set the VM’s “Memory Size” to 4GB and “Max Memory” to 16GB.
**The Limitation:** When Windows hits 100% usage of the 4GB, it will **not** automatically get the extra 12GB. It will simply run out of memory.
**The Action:** An administrator (or a script) must explicitly command the Host to “Hot Plug” more RAM into the VM, or “Deflate” the balloon to release more reserved memory to it.
3.
You cannot rely on KVM to automatically rescue a Windows VM that is running out of RAM.
* **Recommendation:** Enabled KSM (which saves massive amounts of space), it is safer to simply **assign the full amount of RAM** (e.g., 16GB) to the Windows VM from the start.
* **Benefit:** KSM will deduplicate the unused parts anyway, so you get the memory savings of “Dynamic Memory” without the risk of the VM crashing because it couldn’t grow fast enough.
Kernel Samepage Merging (KSM) Optimization
Oracle recommended modifying the KSM value to enhance memory efficiency in virtualized environments.
Overview of KSM:
- Kernel Samepage Merging (KSM) is an advanced memory management feature that identifies identical memory pages across systems and allows them to share a single physical memory page.










