Requesting HugeTLB Pages by Using Kernel Parameters at Boot Time

The precise way to request huge pages at boot time depends upon the system's requirements. The following procedure provides some guidance but isn't exclusive of other approaches to configuring boot options.

The following procedure shows how to set default kernel command line options in your GRUB 2 configuration to specify two pools of HugeTLB pages and a default page size on a system that handles multiple huge page sizes. In this procedure, the following are requested:
  • A default page size of 1 GB.
  • One pool with four HugeTLB pages of 1 GB size.
  • One pool of 1500 HugeTLB pages of 2 MB size.

Before beginning the following procedure, ensure that you have the administrative privileges required.

For more information about configuring kernel command line options and GRUB 2 see Oracle Linux 8: Managing Kernels and System Boot

  1. Edit the default kernel command line options in the system's GRUB 2 configuration.

    Specify 1 GB size for kernel boot parameter default_hugepagesz and 2 pairs of "hugepagesz=<Size_num>G hugepages=Qty_num" parameters for the two huge page pools.

    Append the following line to the kernel command line options in /etc/default/grub

    default_hugepagesz=1G hugepagesz=1G hugepages=4 hugepagesz=2M hugepages=1500
  2. Regenerate the GRUB2 configuration file.
    • If the system uses BIOS firmware, run the following command:

      sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    • If the system uses UEFI framework, run the following command:

      sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

    The next time the system boots, the two huge page pools are requested.