7.13 How are Huge Pages Enabled for Virtual Machines?

Paging is a process whereby the CPU, for a system, allocates contiguous blocks of memory for use by a running process. These pages are tracked by the operating system, so that processes access the correct blocks of assigned memory. Typically, these blocks are sized at 4 KB. This means that when a process uses 1 GB of memory, 262144 page (1 GB/4 KB) entries are created and are referenced continually by the process.

Most current CPU architectures support bigger pages to reduce the number of page lookups required by the CPU or Operating System. On Linux systems, these are called Huge Pages, while on Windows systems they are called Large Pages. These terminologies are equivalent.

By default, Huge Pages are available for hardware virtualized virtual machines (HVM and PVHVM) when the new virtual machine is created. For paravirtualized virtual machines (PVM), the Xen hypervisor must start the virtual machine with a specific parameter set to enable Huge Page support. Oracle VM Manager provides an option to enable huge page support for a paravirtualized virtual machine when you create or edit a virtual machine. Do not attempt to enable Huge Page support for an HVM or PVHVM, as this functionality is not handled by the Xen hypervisor, but rather by the virtual machine itself.

For huge pages to be supported in the virtual machine, depending on the operating system of the virtual machine, huge pages may need to be enabled inside the virtual machine. For example, in Linux, this is done by specifying the Linux boot command line flag balloon_hugepages inside the virtual machine.

For virtual machines running on SPARC architecture, HugePages are referred to as Large Pages and are always enabled by default. The Oracle VM Manager setting to enable or disable HugePages support has no effect on virtual machines running on Oracle VM Server for SPARC.

The following points are worth considering if enabling Huge Page support on your paravirtualized virtual machines.

  • Huge pages can only be changed when the virtual machine is stopped.

  • It is always safe to set huge pages on a virtual machine. It just means the entire guest will be allocated with huge pages, regardless of whether it uses them or not.

  • It is not always safe to turn off huge pages on a virtual machine. If the virtual machine has been enabled to use huge pages (from inside the virtual machine's operating system) and if Huge Page support is disabled in Oracle VM Manager, then the underlying memory is unlikely to be aligned correctly. The Huge Page code in the operating system may check for this and fail with an error.

  • If there are virtual machines configured Huge Page support disabled, the server where they are running may report that it has enough memory to run a given virtual machine. However, if the virtual machine that is scheduled to run on that server has Huge Page support enabled, the start (or migrate) may fail as the memory on that server may be fragmented such that there is not enough huge page memory available to run the virtual machine. To avoid these issues it is not possible to run virtual machines that have Huge Page support enabled on the same server as those with Huge Page support disabled.

  • If you have configured PVMs with Huge Page support enabled within Oracle VM Manager and you have PVHVMs or HVMs co-existing within your environment, you are not able to run these virtual machines on the same server. This is because it is not possible for Oracle VM Manager to determine whether or not Huge Pages are actually enabled within a PVHVM or HVM and then manage memory allocation appropriately.

See Create Virtual Machine in the Oracle VM Manager User's Guide for more information on this option.