Johncooper (talk | contribs) |
|||
Line 25: | Line 25: | ||
# KVM support for huge pages | # KVM support for huge pages | ||
# libvirt [http://www.redhat.com/archives/libvir-list/2009-July/msg00699.html patch posted] for running guests with <code>-mem-path /dev/hugepages</code> | # libvirt [http://www.redhat.com/archives/libvir-list/2009-July/msg00699.html patch posted] for running guests with <code>-mem-path /dev/hugepages</code> | ||
# libvirt [http://www.redhat.com/archives/libvir-list/2009-July/msg00753.html patch-v2 posted] which detects the host's hugetlbfs mount point automatically. | |||
== Detailed Description == | == Detailed Description == |
Revision as of 01:33, 24 July 2009
KVM Huge Page Backed Memory
Summary
Enable KVM guests to use huge page backed memory in order to reduce memory consumption and improve performance by reducing CPU cache pressure.
Owner
- Chris Wright -- chrisw redhat com
- John Cooper -- john.cooper redhat com
Current status
- Targeted release: Fedora 12
- Last updated: 2009-07-23
- Percentage of completion: 90%
TODO
- Ensure the libvirt patch is in 0.7.0
- Testing
Completed
- KVM support for huge pages
- libvirt patch posted for running guests with
-mem-path /dev/hugepages
- libvirt patch-v2 posted which detects the host's hugetlbfs mount point automatically.
Detailed Description
x86 CPUs usually address memory in 4kB pages, but they also have the ability to use huge pages (4MB on x86_63, 2MB on x86_64 and x86_32 PAE).
By using huge pages for a KVM guest's memory, less memory is used for page tables and CPU cache misses are reduced, thereby increasing performance.
Using huge pages for guest memory does have a downside, however - you can no longer swap nor balloon guest memory.
In order to use huge pages with KVM, one must do the following:
- Mount hugetlbfs to
/dev/hugepages
-mount -t hugetlbfs hugetlbfs /dev/hugepages
- Reserve some memory for huge pages -
sctl vm.nr_hugepages=516
- Pass the hugetlbfs path to
qemu-kvm
-qemu-kvm -mem-path /dev/hugepages
This feature aims to improve allow huge pages to be used with libvirt managed guests.
Benefit to Fedora
Enables Fedora KVM hosts to achieve better performance.
Scope
Huge pages support in KVM already exists, so the remaining work is confined to libvirt.
How To Test
mount -t hugetlbfs hugetlbfs /dev/hugepages
- Reserve some memory for huge pages -
sctl vm.nr_hugepages=516
- Run an existing KVM guest with libvirt
- Confirm the guest has booted correctly
- Confirm the guest is using hugepages by checking
HugePages_Free
in /proc/meminfo
User Experience
Users of KVM guests using huge page backed memory should experience reduced memory usage and improved performance.
Dependencies
None, the work is confined to libvirt.
Contingency Plan
None needed.
Documentation
- Old tutorial
Release Notes
KVM guests running on Fedora can now take advantage of huge page backed memory to and benefit from improved performance and reduced memory usage.