Use this when VMs are short of memory, when planning memory overcommit, or when diagnosing ballooning, swapping or NUMA memory locality.
Memory Virtualization
Memory virtualization maps each VM's guest-physical memory onto host RAM using hardware page tables (EPT/NPT), and lets the host reclaim or overcommit memory with ballooning, page sharing, compression and swapping.
1. Memory virtualization maps guest pages to host pages.
2. Reclaim: sharing, ballooning, compression, swap.
3. Size to demand.
4. Watch host pressure.
5. NUMA and huge pages for performance.
guest page → SLAT → host page
Context & applicabilityCommon mistakes · platform/version boundaries
- Large memory overcommit without monitoring ballooning and swapping.
- Ballooning drivers missing in guests, so hosts jump straight to swapping.
- VMs larger than one NUMA node's memory without vNUMA.
- Memory limits left from templates.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
Guest memory is the RAM configured for a VM and seen by its OS.
Subtopic Host MemoryHost memory is the physical RAM of the hypervisor host, shared between the hypervisor, VM overhead and every VM's guest memory.
Subtopic Memory OvercommitMemory overcommit assigns more RAM to VMs than the host physically has, relying on unused memory, page sharing and ballooning.
Subtopic BallooningBallooning lets the hypervisor reclaim memory through a driver inside the guest (vmmemctl, virtio-balloon, Hyper-V Dynamic Memory) that inflates and hands unused guest pages back to the host under memory pressure.
Subtopic Memory SharingMemory sharing (Transparent Page Sharing on ESXi, KSM on KVM) deduplicates identical memory pages across VMs.
Subtopic SwappingHypervisor swapping moves VM memory pages to disk when host RAM is exhausted.
Subtopic Huge PagesHuge pages back VM memory with 2 MB or 1 GB pages instead of 4 KB, reducing TLB misses and page-table overhead for large or latency-sensitive VMs.
Subtopic NUMAMemory NUMA placement keeps a VM's memory on the same NUMA node as the cores running its vCPUs.
Subtopic Memory PressureMemory pressure is the state where VM demand approaches host RAM, so the host starts reclaiming with ballooning, compression and swapping.
Subtopic Memory TroubleshootingTroubleshoot VM memory by checking guest usage and paging inside the VM, then host-side ballooning, compression, swap-in rates and NUMA locality; host swapping or high balloon size points to overcommit rather than a guest problem.
- Consumed host memory ≠ active guest memory.
- Ballooning means host pressure, not a guest problem.
- Host swapping is the slowest reclaim — treat it as an incident.
virsh dommemstat <vm>— VM memory statsfree -h— host memoryesxtop (m)— ESXi memory
ReferenceWhy it matters1 section · depth on demand
Memory techniques overview
| Technique | Purpose |
|---|---|
| EPT/NPT | Hardware translation of guest to host memory |
| Large/huge pages | Fewer TLB misses |
| Page sharing (TPS/KSM) | Deduplicate identical pages |
| Ballooning | Reclaim unused guest memory |
| Compression | Compress pages before swapping |
| Host swapping | Last resort, very slow |
| NUMA placement | Keep memory local to the vCPUs |
ReferenceHow it works1 section · depth on demand
In depth
Memory virtualization gives each VM its own guest-physical address space mapped to host memory through EPT/NPT. The hypervisor can back that memory fully up front, lazily on first touch, share identical pages between VMs, reclaim through ballooning or, as a last resort, swap to disk.
Key metrics: configured vs active (touched recently) vs consumed (host memory backing it), balloon size, swapped memory, and host free memory. Healthy hosts show no host swapping and little or no ballooning.
ReferenceImportant terms & boundaries1 section · depth on demand
Techniques per platform
| Technique | ESXi | KVM/Proxmox | Hyper-V |
|---|---|---|---|
| Page sharing | TPS (intra-VM default) | KSM | No |
| Ballooning | vmmemctl | virtio-balloon | Dynamic Memory |
| Compression | Yes | zswap (host) | No |
| Host swap | .vswp files | Host swap | Smart paging (at boot) |
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Memory Virtualization. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://libvirt.org/docs.html · confidence 94%