Virtual Machine Memory Overcommitment via Shared Zero Page Mapping
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing virtual machine creation methods consume initial physical memory for all virtual machines, which restricts the number that can start concurrently, limiting virtual machine density due to memory constraints.
Innovation Solution
Mapping guest frame numbers to a shared zero page and using a copy-on-write mechanism to allocate physical memory only when needed, reducing memory usage during startup and improving virtual machine density by releasing unused memory pages back to a pool.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If physical memory pages are allocated to all virtual machines during startup, then each virtual machine has sufficient memory for initialization, but the total number of virtual machines that can start concurrently is limited by physical memory capacity
Solution Approach 1:
Multiple virtual machines share a single physical memory page (the shared zero page) during their startup phase. Instead of allocating separate physical pages to each VM, the patent merges the memory resources by having all VMs reference the same physical page until they need to write to it, thereby reducing total memory consumption and enabling more concurrent VMs.
Solution Approach 2:
The shared zero page is prepared in advance with all bytes set to zero, eliminating the need for each VM to individually initialize its memory pages during startup. This preliminary preparation of memory content allows VMs to start without requiring separate allocated pages, as the shared page already contains the required initial state.
2Quantity of substance
If memory is overcommitted to exceed physical memory size, then virtual machine density increases, but memory management complexity increases with additional mechanisms required
Solution Approach 1:
When a virtual machine needs to write to a page, the system creates a copy of the shared zero page for that specific VM. This copying mechanism enables memory overcommitment because multiple VMs can have their own copies only when needed, while sharing the original page when not writing, thus increasing virtual memory capacity without proportionally increasing physical memory requirements.
Data Source
AI summary
A method for creating virtual machine, a virtual machine monitor and a virtual machine system are provided in the embodiments of this application. The method comprises: mapping guest frame number (GFN) corresponding to a pseudo-physical memory of a virtual machine to a shared zero page, the shared zero page being a page having content of all zeros in physical memory; when the GFN is written by the virtual machine and if a page exception occurs, allocating a physical memory page to relieve the mapping relation between the guest frame number (GFN) and the shared zero page, and establishing a mapping relation between the guest frame number (GFN) and a machine frame number (MFN) of the physical memory page. The method can reduce the amount of memory used in virtual machine startup, improve virtual machine density, and support the concurrent startup of a memory overcommitted number of virtual machine.


