Este contenido no está disponible en el idioma seleccionado.

8.3.3.2. Configuring Static Huge Pages


In some cases, greater control of huge pages is preferable. To use static huge pages on guests, add the following to the guest XML configuration:
<memoryBacking>
	<hugepages/>
</memoryBacking>
Copy to Clipboard Toggle word wrap
This instructs the host to allocate memory to the guest using huge pages, instead of using the default page size.
To view the current huge pages value, run the following command:
cat /proc/sys/vm/nr_hugepages
Copy to Clipboard Toggle word wrap

Procedure 8.1. Setting huge pages

The following example procedure shows the commands to set huge pages.
  1. View the current huge pages value:
    # cat /proc/meminfo | grep Huge
    AnonHugePages:      2048 kB
    HugePages_Total:       0
    HugePages_Free:        0
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:       2048 kB
    Copy to Clipboard Toggle word wrap
  2. Huge pages are set in increments of 2MB. To set the number of huge pages to 25000, use the following command:
    echo 25000 > /proc/sys/vm/nr_hugepages
    Copy to Clipboard Toggle word wrap

    Note

    To make the setting persistent, add the following lines to the /etc/sysctl.conf file on the guest machine, with X being the intended number of huge pages:
    # echo 'vm.nr_hugepages = X' >> /etc/sysctl.conf
    # sysctl -p
    
    Copy to Clipboard Toggle word wrap
    Afterwards, add transparent_hugepage=never to the kernel boot parameters by appending it to the end of the /kernel line in the /etc/grub2.cfg file on the guest.
  3. Mount the huge pages:
    # mount -t hugetlbfs hugetlbfs /dev/hugepages
    Copy to Clipboard Toggle word wrap
  4. Restart libvirtd, then restart the virtual machine:
    # service libvirtd restart
    Stopping libvirtd daemon:                                  [  OK ]
    Starting libvirtd daemon:                                  [  OK ]
    Copy to Clipboard Toggle word wrap
    # virsh start virtual_machine
    Copy to Clipboard Toggle word wrap
  5. Verify the changes in /proc/meminfo:
    # cat /proc/meminfo | grep Huge
    AnonHugePages:         0 kB
    HugePages_Total:   25000
    HugePages_Free:    23425
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:       2048 kB
    Copy to Clipboard Toggle word wrap
Huge pages can benefit not only the host but also guests, however, their total huge pages value must be less than what is available in the host.
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2026 Red Hat