我要评分
获取效率
正确性
完整性
易理解

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
    vim /etc/grub2-efi.cfg
    

    Add default_hugepagesz=2M hugepagesz=2M hugepages=50000 to the kernel cmdline. As shown in the following figure, the default huge page size is 2 MB and the number of huge pages is 50,000. Restart 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>