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

Guest Transparent Dynamic Memory Balancing in Virtual Machines

Embed Size (px)

Citation preview

Page 1: Guest Transparent Dynamic Memory Balancing  in Virtual Machines

Guest Transparent Dynamic Memory Balancing in Virtual Machines

Changwoo Min, Inhyuk Kim, Taehyoung Kim, Young Ik Eom

Motivation Memory could be a bottleneck in server consolidation. - It is difficult to share among guest, because it is a non-renewable resource. - Efficient memory management scheme is needed to balance memory allocation according to demand of each guest. Previous studies have limitations. - Estimation of memory demand is limited. - Cannot work with hardware nested paging, Intel EPT. - Need to modify guest OS.

Goal Dynamic memory balancing scheme that does not require modifying guest OS.

Key Techniques Working Set Size Estimation - Estimation Model: LRU histogram - Monitoring Page Access hardware nested paging - Monitoring Guest Swapping paravirtualized swap device Rebalancing Memory Allocation - Guest Page Reclaiming: ballooning technique

For Further Information Please, contact Changwoo Min ([email protected])

Monitoring Page Access Guest Physical Page Access - Turns off presence bit in a nested page table entry for a page - Monitors a nested page fault and update LRU histogram Update page list and LRU histogram Reducing Monitoring Overhead - Do NOT monitor some number of hot pages that could be accessed soon 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

Hot List (not monitored)

Cold List (monitored, swapped-out)

Warm List (monitored)

nested page fault

Monitoring Guest Swapping Why do we need it? - In order to estimate memory demand larger than the current memory allocation Guest physical access monitoring cannot reflect demand beyond its allocated memory size. How to monitor swapping in a guest transparent way - Use para-virtualized swap device Backend driver in QEMU handles actual swapping operation. - Update page list and LRU histogram to reflect memory demand larger than the current allocation size. VMM swapping without double paging - VMM swapping is need to cope with delayed memory reclamation of ballooning technique. - Double paging could decrease performance significantly when a guest tries to swap out a page that is already swapped out by VMM. A page should be swapped in by VMM for a guest to swap out. Swap back-end device is shared between guest and VMM. In such double paging case, swap back-end driver omits block I/O and just updates sector mapping table.

Guest Kernel QEMU

Host Kernel/Hypervisor

Swap File

Swap Subsystem

Block Device Emulation

guest swap in/out

VMM

VMM swap in/out

block I/O

Swap Front-end Driver

Swap Back-end Driver

Rebalancing Memory Allocation 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

Guest Kernel QEMU

Host Kernel/Hypervisor

… …

Nested Page Table

PTE of swapped-out page is invalidated.

… …

Guest Page Table

PTE of swapped-out page is marked as swapped out page ID.

Allocation Bitmap

Page Slot Allocation Status

GFN Hash Table <Guest Physical Frame Number, Physical Page Slot Number>

Guest Swap Radix Tree <Guest Page Slot Number, Physical Page Slot Number>

Hot List Warm List Cold List

Page List