VM Memory Page Reset to Zero for Boot Time Reduction
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Virtual Machines running Microsoft Windows face significant memory overhead during startup due to zeroing out all allocated memory pages, leading to overcommitment issues and slow boot times, especially when multiple VMs are started simultaneously, with existing solutions like hacking boot code or using KSM being undesirable or inefficient.
Innovation Solution
A method where the hypervisor maps guest memory pages to a single host page, handles page faults, and transfers ownership of pages to the guest OS for zeroing, reducing the need for extensive host memory allocation and minimizing disk operations.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If all guest memory pages are zeroed out during VM boot up, then memory security is ensured, but memory usage increases and boot time is extended
Solution Approach 1:
The host OS pre-allocates and pre-zeroes a single shared memory page before VM startup. This preliminary action ensures that when the VM needs memory pages, they are already prepared and ready for immediate use, eliminating the need for the guest OS to zero pages during boot up.
Solution Approach 2:
Instead of allocating separate physical memory pages for each guest memory page, the system creates a virtual copy mechanism where multiple guest pages map to a single host memory page. The guest OS receives virtual page copies that reference the shared host page, reducing actual memory consumption while maintaining the appearance of having separate pages.
2Quantity of substance
If multiple VMs are allocated excessive memory, then memory availability for each VM is ensured, but host memory overcommitment occurs
Solution Approach 1:
Multiple guest memory pages from different VMs are merged and mapped to a single shared host memory page. When the guest OS needs to zero pages, it operates on the shared host page, and this zeroing effect is reflected for all mapped guest pages. This merging allows the host to allocate less physical memory while still providing adequate virtual memory to multiple VMs.
Solution Approach 2:
A single host memory page serves multiple functions by being shared among multiple guest VMs. The same physical page can be mapped to different virtual addresses in different VMs, allowing one piece of memory to fulfill the needs of multiple VMs simultaneously, thus preventing overcommitment while maintaining adequate allocation.
3Reliability
If guest OS zeroes all allocated memory pages, then memory initialization is complete, but disk swapping increases due to insufficient host memory
Solution Approach 1:
The host OS performs the memory zeroing operation in advance during its own boot up or idle period, before the guest VM starts. This preliminary initialization ensures that when the guest OS requests memory pages, they are already zeroed and ready for use, eliminating the need for guest OS to perform time-consuming zeroing operations that would require disk swapping.
Data Source
AI summary
A method for zeroing guest memory of a VM during boot up, includes the guest OS attempts to set a page to zero. A page fault is generated and is handled by the hypervisor. The page is mapped by the hypervisor to a page in host memory, and is given to the guest. The guest OS attempts to set the next page to zero. Another page fault is generated the hypervisor unmaps the host memory page, and the second page is mapped to the same page. The hypervisor then gives the page to the guest, which contains all zeros. The process is repeated for remaining pages of the guest memory.


