490 likes | 698 Views
HUGEPAGE SUPPORT IN LINUX BASED VIRTUALIZATION. External guide– Internal guide- Mr. Kedar Sovani Prof Mukta Takalikar DREAMZ Group. PICT,Pune . Group members – Aditya Gadre B3054204 Keshav Darak B3054243 Kaustubh Kabra B3054279 Ashwin Vasani B3054365.
E N D
HUGEPAGE SUPPORT IN LINUX BASED VIRTUALIZATION • External guide–Internal guide- Mr. KedarSovani Prof MuktaTakalikar DREAMZ Group. PICT,Pune. • Group members– • AdityaGadre B3054204 • KeshavDarak B3054243 • KaustubhKabra B3054279 • AshwinVasani B3054365
PROBLEM DEFINITION To design a memory management unit (MMU) based paging mechanism in Xen hypervisor which will add support for huge pages (2MB) such that 4 KB pages and huge pages will now co-exist for a paravirtualized domain kernel to improve performance.
BUSINESS VALUE ARCHITECTURE REVIEW APPLICATIONS & FUTURE ENHANCEMENTS X-XEN CURRENT SCENARIO CHALLENGES IMPLEMENTATION PERFORMANCE
HUGE PAGE Huge page translation reduces the normal page walk by 1 level. The Huge page TLB cache improves the performance by increasing the speed by15% to 20%.
Virtual address 3 Only 2 memory access additional to reach to a byte 4 KB page Singleton Physical address 1 2 PS 2 MB page Huge Page 3 memory acccess additional to reach to a byte Physical address Virtual address
HUGE PAGE Huge page translation reduces the normal page walk by 1 level. The Huge page TLB cache improves the performance by increasing the speed by15% to 20%.
TLB Scenario RAM TLB Cache VA PA 1 entry 512 entries 2 MB
Bare Metal VS XEN Hardware Hardware
XEN ??
BUSINESS VALUE ARCHITECTURE REVIEW APPLICATIONS & FUTURE ENHANCEMENTS X-XEN CURRENT SCENARIO CHALLENGES IMPLEMENTATION PERFORMANCE
BUSINESS VALUE ARCHITECTURE REVIEW APPLICATIONS & FUTURE ENHANCEMENTS X-XEN CURRENT SCENARIO CHALLENGES IMPLEMENTATION PERFORMANCE
Requesting 2MB Requesting 4KB DOMU (1) DOM U (2) Memory Request denied Hypervisor RAM
PROBLEM DEFINITION To design a memory management unit (MMU) based paging mechanism in Xen hypervisor which will add support for huge pages (2MB) such that 4 KB pages and huge pages will now co-exist for a paravirtualized domain kernel to improve performance.
BUSINESS VALUE ARCHITECTURE REVIEW • APPLICATIONS & FUTURE ENHANCEMENTS X-XEN CURRENT SCENARIO CHALLENGES IMPLEMENTATION PERFORMANCE
CONCEPTS Kernel Domain Kernel Domain Kernel VA VA_to_PFN VA_to_PFN PFN RAM Hypervisor P2M MFN • VA : Virtual Address in Kernel • PFN : Physical Frame Number • MFN : Machine Frame Number • P2M Mapping: Physical to Machine Mapping
IMPLEMENTATION OVERVIEW Requesting 2MB Requesting 4KB DOMU (1) Hypervisor Boot time reservation of memory RAM
Implementation steps : 1. Domain creation 2. Domain booting 3. Demand supply
Implementation steps : 1. Domain creation 2. Domain booting 3. Demand supply
Domain creation Domain’s Config memory=900 ---------------------- ---------------------- ---------------------- struct domain{ hugepage_num; hugepage_list; }; hugepage_num=50 50 Domain Create MFNs Xen’s Allocator RAM Xen MFNs
Implementation steps : 1. Domain creation 2. Domain booting 3. Demand supply
Domain booting xen_extra_mem_start Kernel 900M 800M Kernel Booting Hypercall to Get hugepage count Xen Hypervisor struct domain{ hugepage_num; hugepage_list; }; PFNs 50
Implementation steps : 1. Domain creation 2. Domain booting 3. Demand supply
Demand xen_extra_mem_start Kernel 900M 800M Hugepage Request Kernel PFN Hypercall to Allocate hugepage P2M MFN Xen Hypervisor RAM MFN Xen PFNs MFNs struct domain{ hugepage_num; hugepage_list; };
FINAL VISION(Transparent Huge Pages) Requesting 4KB Requesting 2MB DOMU (1) DOM U (2) Hypervisor RAM
BUSINESS VALUE ARCHITECTURE REVIEW • APPLICATIONS & FUTURE ENHANCEMENTS X-XEN CURRENT SCENARIO- AMAZON DEMO CHALLENGES IMPLEMENTATION PERFORMANCE
PERFORMANCE GRAPHS Threads =4 Threads =6 Threads =8 Threads =10 X axis: Memory read and wrote (in MBs) Y axis: Time required (in seconds)
BUSINESS VALUE ARCHITECTURE REVIEW • APPLICATIONS & FUTURE ENHANCEMENTS X-XEN CURRENT SCENARIO CHALLENGES IMPLEMENTATION PERFORMANCE
Challenge 1 : Paging DOCUMENTATION
Challenge 2 : Handling read-only ptes in guest domains Read-Only Access to Guest Page Tables Read-Only Access to Guest Page Tables Xen Hypervisor
Challenge 3 (1/2): Aligned PFNs and unaligned MFNs Domain Kernel 512 aligned pfns for Huge Pages PFN 2MB Boundary Xen Hypervisor Unaligned non- contiguous 512MFNs MFN
Challenge 3 (1/2): Aligned PFNs and unaligned MFNs Domain Kernel Unaligned un-contiguous PFN PFN Xen Hypervisor Aligned (512 )MFN MFN 2MB Boundary
Our solution: Aligned PFNs and Aligned MFNs Domain Kernel 512 aligned pfns for Huge Pages PFN 2MB Boundary Hypervisor can complete request successfully Aligned (512 )MFN MFN 2MB Boundary
BUSINESS VALUE ARCHITECTURE REVIEW • APPLICATIONS & FUTURE ENHANCEMENTS X-XEN CURRENT SCENARIO CHALLENGES IMPLEMENTATION PERFORMANCE
FUTURE ENHANCEMENTS • Existing Live Migration implementations need to be compatible with this implementation. • Support for 1GB huge pages.
REFERENCES • http://linuxgazette.net/155/krishnakumar.html : HugeTLB - Large Page Support in the Linux Kernel • “Memory Management in Linux”by AbhishekNayani, Mel Gorman & Rodrigo • “XEN Memory Management (Intel IA-32)” by Andr´esKrapf. • “Memory Overcommit without the commitment” by Dan Magenheimer, Oracle Corp. Xen Summit, June 2008 • “Xen and art of virtualization”By P. Barham, B.Dragovic, K. Fraser, S. Hand, T. Harris, A. Ho, R. Neugebauer, I. Pratt, and A. Warfield. In Proc. SOSP, 2003
CONTRIBUTION • Patch submitted for review to Jeremy Fitizhardinge, Keir Fraser and Xen-Devel community • http://tinyurl.com/HugePagea2k2Patch1 • www.github.com/a2k2/ • Kernel-PV-hugepages • Xen-hugepages • XEN memory: Enlightening memory management in XEN - Team a2k2 • www.ashwinvasani.wordpress.com • Summarized documentation of the project • www.xxen-docs.co.cc
AWARDS 1 CONCEPTS-2011 • 1st in Systems • 2nd in Open Software • PLUG trophy PROJECT @ INTECHXICATION ,MIT PAPER PRESENTED @ OTTAWA LINUX SYMPOSIUM PROJECT @ BHARTEEYAM ,BVP PROJECT @ TESLA ,MITCOE PROJECT @ ZION ,DY PATIL PAPER @ EXCELSIOR ,Sinhagad PAPER @ TESLA ,MITCOE POSTER @ TESLA ,MITCOE 2 POSTER @ ZION ,DY PATIL 3 PAPER @ BHARTEEYAM ,BVP PROJECT @ IMPETUS ,PICT PAPER @ TECHKRITI , IIT-Kanpur
ENLIGHTENERS • KedarSovani (Marvell & Former Maintainer of Fedora- ARM) • Prof. MuktaTakalikar (PICT) • Jeremy Fitizhardinge (PV-Kernel maintainer) • Keir Fraser (Xen maintainer) • Dan Magenheimer (Tmem maintainer) • Tim Deegan (Citrix)