Streaming DMA Accelerator Functional Unit User Guide: Intel® Programmable Acceleration Card with Intel® Arria® 10 GX FPGA

ID 683840
Date 3/06/2020
Public

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

If you have already boot your system into the operating system, you can enable two 1 GB hugepages by running the following command:
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

This section explains how to enable two 1 GB hugepages and twenty 2 MB hug pages persistently so that the setting remains persistent across reboots and power cycles.
  • In Ubuntu: Perform the following steps to enable two 1 GB hugepages and twenty 2 MB hugepages on a Ubuntu system:
    1. 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" 
    2. Save the GRUB file.
    3. Update GRUB by committing the updated settings:
      sudo update-grub
    4. Reboot the system.
  • In RHEL: Perform the following steps to enable two 1 GB hugepages and twenty 2 MB hugepages on a RHEL system:
    1. 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"
    2. Save the GRUB file.
    3. Update GRUB by committing the updated settings:
      sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
    4. Reboot the system.

Persistently Disabling 1 GB Hugepages

To revert your system back to its default boot settings, follow the instructions from section Persistently Enabling 1 GB Hugepages and remove the text that you added in step 1, and then follow steps 2 to 4. If you need to periodically enable and disable hugepages, instead of removing test from step 1 simply comment out the line by post-pending "#" to comment the line out.