Rate This Document
Findability
Accuracy
Completeness
Readability

Enabling Huge Page Memory

Enabling huge page memory minimizes page table hierarchy levels for memory access and reduces TLB misses, which substantially lowers memory management overhead during network protocol stack operations. This optimization results in improved network throughput and reduced latency.

  1. Modify the kernel cmdline startup parameters. The following method adds the target huge page size and quantity to the startup parameters, enabling huge pages permanently.
    1. Open the grub2-efi.cfg file.
      vim /etc/grub2-efi.cfg
    2. Press i to enter the insert mode and add default_hugepagesz=2M hugepagesz=2M hugepages=50000 to cmdline. As shown in the following figure, the default huge page size is 2 MB and the number of huge pages is 50,000.

    3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
    4. Run the reboot command to reboot the server.
  2. Check the huge page configuration.
    1
    cat /proc/sys/vm/nr_hugepages
    

  3. Configure huge pages in the VM XML file.
    1
    virsh edit <VM_name>
    
    Specify the size in page size, that is, the size of the huge page memory enabled for the VM.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <domain type = 'KVM'>
    ...
      <memoryBacking>
        <hugepages>
          <page size='2048' unit='KiB'/>
        </hugepages>
      </memoryBacking>
    ...
    <domain>