Features/KVM Huge Page Backed Memory

From FedoraProject

< Features
Revision as of 10:26, 16 June 2009 by Markmc (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

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

Current status

  • Targeted release: Fedora 12
  • Last updated: 2009-06-16
  • Percentage of completion: 60%

TODO

  1. Add support to libvirt for running guests with -mem-path
  2. Investigate ways to make it easier to configure the host for huge page usage

Completed

  1. KVM support for huge pages

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:

  1. Mount hugetlbfs to some path - mount -t hugetlbfs hugetlbfs dev/hugepages
  2. Reserve some memory for huge pages - sctl vm.nr_hugepages=516
  3. Pass the hugetlbfs path to qemu-kvm - qemu-kvm -mem-path /dev/hugepages

There is currently no way to use huge pages with a libvirt managed KVM guest.

This feature aims to improve the situation by:

  1. Allowing huge pages to be used with libvirt managed guests
  2. Possibly making it easier to configure the host for huge page usage

Benefit to Fedora

Enables Fedora KVM hosts to achieve better performance.

Scope

The most obvious work required here is in libvirt.

Making it easier to configure the host for huge page usage might involve work in other parts of the distro - e.g. settling on a default mount point for hugegtlbfs or allowing vm.nr_hugepages to be configured somewhere.

How To Test

User Experience

Dependencies

Contingency Plan

Documentation

Release Notes

Comments and Discussion