Guest Transparent Dynamic Memory Balancing in Virtual Machines
1. Guest Transparent Dynamic Memory Balancing
in Virtual Machines
Changwoo Min, Inhyuk Kim, Taehyoung Kim, Young Ik Eom
Motivation Monitoring Guest Swapping
Memory could be a bottleneck in server consolidation. Why do we need it?
- It is difficult to share among guest, - In order to estimate memory demand larger
because it is a non-renewable resource. than the current memory allocation
- Efficient memory management scheme is needed Guest physical access monitoring cannot reflect demand
to balance memory allocation according to demand beyond its allocated memory size.
of each guest.
How to monitor swapping in a guest transparent way
Previous studies have limitations. - Use para-virtualized swap device
- Estimation of memory demand is limited. Backend driver in QEMU handles actual swapping operation.
- Cannot work with hardware nested paging, Intel EPT. - Update page list and LRU histogram to reflect memory
- Need to modify guest OS. demand larger than the current allocation size.
Guest Kernel QEMU
Swap Subsystem Block Device
Goal Swap
Emulation
Swap
Front-end Driver Back-end Driver
Dynamic memory balancing scheme that does not require guest Host Kernel/Hypervisor
modifying guest OS. swap in/out
block
VMM
swap in/out I/O
VMM
Key Techniques Swap File
Working Set Size Estimation VMM swapping without double paging
- Estimation Model: LRU histogram - VMM swapping is need to cope with delayed memory
- Monitoring Page Access reclamation of ballooning technique.
hardware nested paging - Double paging could decrease performance significantly
- Monitoring Guest Swapping when a guest tries to swap out a page that is already
paravirtualized swap device swapped out by VMM. A page should be swapped in
by VMM for a guest to swap out.
Rebalancing Memory Allocation Swap back-end device is shared between guest and VMM.
- Guest Page Reclaiming: ballooning technique In such double paging case, swap back-end driver omits
block I/O and just updates sector mapping table.
Guest Kernel QEMU
Monitoring Page Access Guest Page Table
Guest Swap Radix Tree
<Guest Page Slot Number,
Physical Page Slot Number>
GFN Hash Table
Guest Physical Page Access <Guest Physical Frame Number,
… Physical Page Slot Number>
- Turns off presence bit in a nested page table entry for a page …
PTE of swapped-out
- Monitors a nested page fault and update LRU histogram page is marked as
swapped out page ID.
Allocation Bitmap
Update page list and LRU histogram Page Slot Allocation Status
Host Kernel/Hypervisor
Reducing Monitoring Overhead Nested Page Table Page List
- Do NOT monitor some number of hot pages
that could be accessed soon …
PTE of swapped-out Hot List Warm List
page is invalidated.
Cold List
Dynamically adjusting the number of hot pages …
considering tradeoff between overhead and accuracy
- Use extended red-black tree to calculate LRU stack distance
in logarithmic time
Rebalancing Memory Allocation
nested page fault New Memory Allocation Size
- A working set size is estimated from its LRU histogram.
- Allocation size is proportionally determined over total
estimated working set size for all guests.
Reclaiming Memory from Guests
- Send ballooning request for a guest to give free memory back
Hot List Warm List Cold List
For Further Information
(not monitored) (monitored) (monitored, swapped-out)
Please, contact Changwoo Min (multics69@ece.skku.ac.kr)