A. Enabling Hugepages
This section covers information about how to enable 1 GB hugepages temporarily and persistently. Intel® recommends you to begin by temporarily enabling huge pages and later if you want to avoid revisiting the steps to enable hugepages persistently.
Temporarily Enabling 1 GB Hugepages
sudo sh -c "echo 2 > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages"
You can also enable two 1 GB hugepages and twenty 2 MB hugepages at boot time by passing the following boot time arguments to GRUB:
default_hugepagesz=2MB hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=20
By enabling 2 MB hugepages as the default hugepage size, when software allocates buffers between 4 KB and 2 MB the memory allocation system will default to 2 MB hugepages instead of 1 GB hugepages. Some of the other acceleration stack examples require up to twenty 2 MB hugepages so setting both page sizes as shown above will allow those designs to continue operating correctly using the same settings.
Persistently Enabling 1 GB Hugepages
- In Ubuntu: Perform the following steps to enable two 1 GB hugepages and twenty 2 MB hugepages on a Ubuntu system:
- Edit /etc/default/grub and add the following text to the end of the file:
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} default_hugepagesz=2MB hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=20"
- Save the GRUB file.
- Update GRUB by committing the updated settings:
sudo update-grub
- Reboot the system.
- Edit /etc/default/grub and add the following text to the end of the file:
- In RHEL: Perform the following steps to enable two 1 GB hugepages and twenty 2 MB hugepages on a RHEL system:
- Edit /etc/default/grub and add the following text to the end of the file:
GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} default_hugepagesz=2MB hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=20"
- Save the GRUB file.
- Update GRUB by committing the updated settings:
sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
- Reboot the system.
- Edit /etc/default/grub and add the following text to the end of the file: