Also available as:
loading table of contents...

Enable Transparent Huge Pages

The probe performs its own memory management by leveraging transparent huge pages. In Linux, Transparent Huge Pages (THP) can be enabled either dynamically or on boot. It is recommended that these be allocated on boot to increase the chance that a larger, physically contiguous chunk of memory can be allocated.

The size of THPs that are supported will vary based on your CPU. These typically include 2 MB and 1 GB THPs. For better performance, allocate 1 GB THPs if supported by your CPU.

  1. Ensure that your CPU supports 1 GB THPs. A CPU flag pdpe1gb indicates whether or not the CPU supports 1 GB THPs.

    grep --color=always pdpe1gb /proc/cpuinfo | uniq
  2. Add the following boot parameters to the Linux kernel. Edit /etc/default/grub and add the additional kernel parameters to the line starting with GRUB_CMDLINE_LINUX.

    GRUB_CMDLINE_LINUX=... default_hugepagesz=1G hugepagesz=1G hugepages=16
  3. Rebuild the grub configuration then reboot. The location of the Grub configuration file will differ across Linux distributions.

    cp /etc/grub2-efi.cfg /etc/grub2-efi.cfg.orig
    /sbin/grub2-mkconfig -o /etc/grub2-efi.cfg
  4. Once the host has been rebooted, ensure that the THPs were successfully allocated.

    $ grep HugePage /proc/meminfo
    AnonHugePages:    933888 kB
    HugePages_Total:      16
    HugePages_Free:        0
    HugePages_Rsvd:        0
    HugePages_Surp:        0

    The total number of huge pages that you have been allocated should be distributed fairly evenly across each NUMA node. In the following example, a total of 16 THPs were requested and 8 have been assigned on each of the 2 NUMA nodes.

    $ cat /sys/devices/system/node/node*/hugepages/hugepages-1048576kB/nr_hugepages
  5. Once the THPs have been reserved, they need to be mounted to make them available to the probe.

    cp /etc/fstab /etc/fstab.orig
    mkdir -p /mnt/huge_1GB
    echo "nodev /mnt/huge_1GB hugetlbfs pagesize=1GB 0 0" >> /etc/fstab
    mount -fav