Use this to understand how guest memory maps to host RAM and why the host can reclaim it.
Virtual Memory
Virtual memory in a VM is guest-physical RAM that the hypervisor backs with host memory using second-level page tables (EPT/NPT). The guest sees contiguous RAM, while the host can share, balloon or swap the backing pages.
1. Guest physical memory maps to host memory through SLAT.
2. Host RSS can be lower than assigned (not yet touched) or higher (overhead).
3. Ballooning and swapping reduce performance.
4. Size from guest demand.
5. Avoid host swapping.
guest memory → SLAT → host memory pages
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Memory overcommit without monitoring ballooning/swapping.
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.
- Guest sees contiguous RAM; host backs it lazily.
- EPT/NPT makes this efficient.
- Host reclaim affects guest without its knowledge.
virsh dommemstat <vm>— VM memory stats (balloon, rss)Get-VM <vm> | fl Memory*— Hyper-V memory assigned/demandfree -h— guest view
ReferenceWhy it matters1 section · depth on demand
In depth
Virtual memory in a hypervisor has three address spaces: guest-virtual → guest-physical (guest page tables) → host-physical (hypervisor via EPT/NPT). A TLB miss may need a two-dimensional page walk, which is why large pages (2 MiB/1 GiB) on both guest and host help memory-intensive workloads.
The host can back guest memory lazily (allocate on first touch), share identical pages, balloon or swap — all invisible to the guest until performance suffers.
ReferenceHow it works1 section · depth on demand
How guest memory is mapped
Guest virtual address → (guest page tables) → guest physical address → (EPT on Intel / NPT on AMD) → host physical address.
- EPT/NPT removes the old shadow-page-table overhead; TLB misses cost more, which large pages (2 MB/1 GB) reduce.
- The hypervisor can back guest memory lazily, reclaim it (ballooning, swapping) or share identical pages.
- Guest RAM must fit in host RAM plus overcommit techniques; NUMA placement affects latency on large hosts.
ReferenceImportant terms & boundaries2 sections · depth on demand
Platform, version and operating-envelope scope
Memory reclamation and metric names differ by KVM/Proxmox, Hyper-V and VMware platform/version.
Huge pages
Using 2 MB or 1 GB host pages for guest memory reduces TLB misses and EPT walk cost, helping databases and large VMs.
| Platform | Setting |
|---|---|
| KVM/libvirt | <memoryBacking><hugepages/></memoryBacking> with hugepages reserved on the host |
| Proxmox | hugepages: 1024 or 2 in the VM config |
| ESXi | Large pages used by default |
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 Hypervisor Architecture → Virtual Memory. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://libvirt.org/docs.html · confidence 94%